home-assistant/core · error · HomeAssistantError
Failed to turn on {switch}.
Error message
Failed to turn on {switch}. What it means
Raised by the Airobot switch entity's async_turn_on when the entity_description.turn_on_fn call raises AirobotError. HomeAssistantError with translation key switch_turn_on_failed names the switch's description key so the user knows which switch failed.
Source
Thrown at homeassistant/components/airobot/switch.py:101
) -> None:
"""Initialize the switch."""
super().__init__(coordinator)
self.entity_description = description
self._attr_unique_id = f"{coordinator.data.status.device_id}_{description.key}"
@property
@override
def is_on(self) -> bool:
"""Return true if the switch is on."""
return self.entity_description.is_on_fn(self.coordinator)
@override
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn the switch on."""
try:
await self.entity_description.turn_on_fn(self.coordinator)
except AirobotError as err:
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="switch_turn_on_failed",
translation_placeholders={"switch": self.entity_description.key},
) from err
await self.coordinator.async_request_refresh()
@override
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn the switch off."""
try:
await self.entity_description.turn_off_fn(self.coordinator)
except AirobotError as err:
raise HomeAssistantError(
translation_domain=DOMAIN,
translation_key="switch_turn_off_failed",
translation_placeholders={"switch": self.entity_description.key},
) from err
await self.coordinator.async_request_refresh()View on GitHub (pinned to 58a3fdb3ea)
Solutions
- Verify the robot is online and retry
- If other calls also fail with auth-like errors, complete the reauth flow
- Reload the integration to resync state
- Inspect the chained exception in logs for the specific API error
Defensive patterns
Strategy: try-catch
Try / catch
try:
await hass.services.async_call("switch", "turn_on", {"entity_id": eid}, blocking=True)
except HomeAssistantError as err:
_LOGGER.warning("Airobot switch turn_on failed: %s", err) Prevention
- Verify robot connectivity before control automations
- Idempotent designs: re-assert desired switch state on next cycle instead of alerting per failure
- Keep integration authenticated
When it happens
Trigger: Toggling an Airobot switch (e.g. enabling a robot feature) while the corresponding cloud API call fails: device offline, rejected command, or auth error surfacing through the generic AirobotError catch.
Common situations: Turning features on/off while the robot is unreachable, or after credentials expired but before the coordinator has triggered reauth.
Related errors
- Failed to turn off {switch}.
- Failed to press {button} button.
- System generated users cannot enable multi-factor auth modul
- Failed to set temperature to {temperature}.
- Failed to set preset mode to {preset_mode}.
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/a7342fd3c0670c38.
Report an issue: GitHub.