home-assistant/core · error · HomeAssistantError

command_error_offline

Error message

command_error_offline

What it means

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.

Source

Thrown at homeassistant/components/braviatv/coordinator.py:66

    @wraps(func)
    async def wrapper(
        self: _BraviaTVCoordinatorT,
        *args: _P.args,
        **kwargs: _P.kwargs,
    ) -> None:
        """Catch Bravia errors and log message."""
        try:
            await func(self, *args, **kwargs)
        except BraviaNotFound as err:
            raise HomeAssistantError(
                translation_domain=DOMAIN,
                translation_key="command_error_not_found",
                translation_placeholders={
                    "device": self.config_entry.title,
                },
            ) from err
        except (BraviaConnectionError, BraviaConnectionTimeout, BraviaTurnedOff) as err:
            raise HomeAssistantError(
                translation_domain=DOMAIN,
                translation_key="command_error_offline",
                translation_placeholders={
                    "device": self.config_entry.title,
                },
            ) from err
        except BraviaError as err:
            raise HomeAssistantError(
                translation_domain=DOMAIN,
                translation_key="command_error",
                translation_placeholders={
                    "device": self.config_entry.title,
                    "error": repr(err),
                },
            ) from err
        await self.async_request_refresh()

    return wrapper

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Turn the TV on (or verify power state) before sending commands; gate automations on the media player's state != 'off'.
  2. Verify the configured host still resolves to the TV (ping / check router DHCP lease) and update the config entry if the IP changed.
  3. On the TV, enable Settings -> Network -> Remote device settings -> Control remotely and IP Control so the TV stays reachable in standby.
  4. Prefer PSK authentication over PIN during setup — it is more stable across power cycles (see the authorize step description in strings.json).

Example fix

# before (automation fires blindly)
- action: media_player.volume_up
  target: {entity_id: media_player.sony_tv}
# after (only when TV is on)
- condition: state
  entity_id: media_player.sony_tv
  state: "on"
- action: media_player.volume_up
  target: {entity_id: media_player.sony_tv}
Defensive patterns

Strategy: try-catch

Validate before calling

# in an automation/script, guard on state first
{{ states('media_player.sony_tv') not in ['off', 'unavailable', 'unknown'] }}

Try / catch

try:
    await coordinator.async_turn_off()
except HomeAssistantError as err:
    if err.translation_key == "command_error_offline":
        # TV off/unreachable: power on or skip
        pass
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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