home-assistant/core · error · HomeAssistantError

Failed to turn off {switch}.

Error message

Failed to turn off {switch}.

What it means

The turn_off counterpart: Airobot switch's async_turn_off raises HomeAssistantError with translation key switch_turn_off_failed when turn_off_fn hits an AirobotError. Same failure envelope as turn_on, distinguishing only which operation the user attempted.

Source

Thrown at homeassistant/components/airobot/switch.py:114

    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

  1. Confirm robot connectivity and retry
  2. Complete reauth if auth errors are appearing elsewhere
  3. Reload the integration to refresh state and tokens
  4. Check logs for the chained AirobotError detail
Defensive patterns

Strategy: try-catch

Try / catch

try:
    await hass.services.async_call("switch", "turn_off", {"entity_id": eid}, blocking=True)
except HomeAssistantError as err:
    _LOGGER.warning("Airobot switch turn_off failed: %s", err)

Prevention

When it happens

Trigger: Calling switch.turn_off on an Airobot switch while the cloud API call fails — offline device, cloud error, or stale auth.

Common situations: Automations toggling features during robot downtime, or after token expiry.

Related errors


AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14). Data as JSON: /api/errors/1a6e9a792d559500. Report an issue: GitHub.