{"record":{"id":"d076ee7ff3a536b2","repo":"home-assistant/core","slug":"command-error-offline","errorCode":null,"errorMessage":"command_error_offline","messagePattern":"command_error_offline","errorType":"exception","errorClass":"HomeAssistantError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/braviatv/coordinator.py","lineNumber":66,"sourceCode":"    @wraps(func)\n    async def wrapper(\n        self: _BraviaTVCoordinatorT,\n        *args: _P.args,\n        **kwargs: _P.kwargs,\n    ) -> None:\n        \"\"\"Catch Bravia errors and log message.\"\"\"\n        try:\n            await func(self, *args, **kwargs)\n        except BraviaNotFound as err:\n            raise HomeAssistantError(\n                translation_domain=DOMAIN,\n                translation_key=\"command_error_not_found\",\n                translation_placeholders={\n                    \"device\": self.config_entry.title,\n                },\n            ) from err\n        except (BraviaConnectionError, BraviaConnectionTimeout, BraviaTurnedOff) as err:\n            raise HomeAssistantError(\n                translation_domain=DOMAIN,\n                translation_key=\"command_error_offline\",\n                translation_placeholders={\n                    \"device\": self.config_entry.title,\n                },\n            ) from err\n        except BraviaError as err:\n            raise HomeAssistantError(\n                translation_domain=DOMAIN,\n                translation_key=\"command_error\",\n                translation_placeholders={\n                    \"device\": self.config_entry.title,\n                    \"error\": repr(err),\n                },\n            ) from err\n        await self.async_request_refresh()\n\n    return wrapper","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/braviatv/coordinator.py#L48-L84","documentation":"Raised by the @catch_braviatv_errors decorator (homeassistant/components/braviatv/coordinator.py:66) when any coordinator command (turn on/off, volume, source select, play media, remote command) raises BraviaConnectionError, BraviaConnectionTimeout, or BraviaTurnedOff from the underlying bravia-tv library. Home Assistant translates it to the user-facing message 'Error sending command to {device}: the TV is turned off'. It signals the TV is powered off or unreachable over IP Control, not a bug in the integration.","triggerScenarios":"Calling a media player action (turn_off, volume_up, select_source, play_media, send_command) while the TV is in standby/off, unplugged, or when the host/port is wrong or the device dropped off the network. The bravia client raises BraviaTurnedOff/BraviaConnectionError/BraviaConnectionTimeout and the decorator re-raises it as HomeAssistantError with translation_key command_error_offline.","commonSituations":"Automations that send commands on a schedule regardless of TV power state; TV using PSK auth while 'IP Control'/'Control remotely' is disabled; TV deep-sleeping after firmware updates; IP address changed via DHCP so the configured host no longer reaches the TV.","solutions":["Turn the TV on (or verify power state) before sending commands; gate automations on the media player's state != 'off'.","Verify the configured host still resolves to the TV (ping / check router DHCP lease) and update the config entry if the IP changed.","On the TV, enable Settings -> Network -> Remote device settings -> Control remotely and IP Control so the TV stays reachable in standby.","Prefer PSK authentication over PIN during setup — it is more stable across power cycles (see the authorize step description in strings.json)."],"exampleFix":"# before (automation fires blindly)\n- action: media_player.volume_up\n  target: {entity_id: media_player.sony_tv}\n# after (only when TV is on)\n- condition: state\n  entity_id: media_player.sony_tv\n  state: \"on\"\n- action: media_player.volume_up\n  target: {entity_id: media_player.sony_tv}","handlingStrategy":"try-catch","validationCode":"# in an automation/script, guard on state first\n{{ states('media_player.sony_tv') not in ['off', 'unavailable', 'unknown'] }}","typeGuard":null,"tryCatchPattern":"try:\n    await coordinator.async_turn_off()\nexcept HomeAssistantError as err:\n    if err.translation_key == \"command_error_offline\":\n        # TV off/unreachable: power on or skip\n        pass\n    else:\n        raise","preventionTips":["Gate media player automations on the entity state being 'on' before sending commands.","Enable IP Control / 'Control remotely' on the TV so it stays reachable in standby.","Use a static IP or DHCP reservation for the TV to keep the configured host valid."],"tags":["braviatv","home-assistant","offline","media-player","network"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}