{"record":{"id":"1a6e9a792d559500","repo":"home-assistant/core","slug":"failed-to-turn-off-switch","errorCode":null,"errorMessage":"Failed to turn off {switch}.","messagePattern":"Failed to turn off (.+?)\\.","errorType":"exception","errorClass":"HomeAssistantError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/airobot/switch.py","lineNumber":114,"sourceCode":"    async def async_turn_on(self, **kwargs: Any) -> None:\n        \"\"\"Turn the switch on.\"\"\"\n        try:\n            await self.entity_description.turn_on_fn(self.coordinator)\n        except AirobotError as err:\n            raise HomeAssistantError(\n                translation_domain=DOMAIN,\n                translation_key=\"switch_turn_on_failed\",\n                translation_placeholders={\"switch\": self.entity_description.key},\n            ) from err\n        await self.coordinator.async_request_refresh()\n\n    @override\n    async def async_turn_off(self, **kwargs: Any) -> None:\n        \"\"\"Turn the switch off.\"\"\"\n        try:\n            await self.entity_description.turn_off_fn(self.coordinator)\n        except AirobotError as err:\n            raise HomeAssistantError(\n                translation_domain=DOMAIN,\n                translation_key=\"switch_turn_off_failed\",\n                translation_placeholders={\"switch\": self.entity_description.key},\n            ) from err\n        await self.coordinator.async_request_refresh()\n","sourceCodeStart":96,"sourceCodeEnd":120,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/airobot/switch.py#L96-L120","documentation":"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.","triggerScenarios":"Calling switch.turn_off on an Airobot switch while the cloud API call fails — offline device, cloud error, or stale auth.","commonSituations":"Automations toggling features during robot downtime, or after token expiry.","solutions":["Confirm robot connectivity and retry","Complete reauth if auth errors are appearing elsewhere","Reload the integration to refresh state and tokens","Check logs for the chained AirobotError detail"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    await hass.services.async_call(\"switch\", \"turn_off\", {\"entity_id\": eid}, blocking=True)\nexcept HomeAssistantError as err:\n    _LOGGER.warning(\"Airobot switch turn_off failed: %s\", err)","preventionTips":["Same as turn_on: check connectivity, re-assert state in automations","Investigate chained AirobotError in logs when failures cluster"],"tags":["airobot","home-assistant","switch","cloud-api"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}