home-assistant/core · error · HomeAssistantError

connection_failed

connection_failed

Error message

Connection failed to the device.

What it means

HomeAssistantError with translation key 'connection_failed', produced by the convert_exception decorator in arcam_fmj/entity.py. It wraps every entity service method (select_source, set volume, etc.) so that a ConnectionFailed from the arcam-fmj library during a user-initiated action surfaces as a clean, translated 'Connection failed to the device.' error in the UI instead of a raw traceback.

Source

Thrown at homeassistant/components/arcam_fmj/entity.py:27

from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.entity import EntityDescription
from homeassistant.helpers.update_coordinator import CoordinatorEntity

from .const import DOMAIN
from .coordinator import ArcamFmjCoordinator


def convert_exception[**_P, _R](
    func: Callable[_P, Coroutine[Any, Any, _R]],
) -> Callable[_P, Coroutine[Any, Any, _R]]:
    """Convert a connection failure into a translated HomeAssistantError."""

    @functools.wraps(func)
    async def _convert_exception(*args: _P.args, **kwargs: _P.kwargs) -> _R:
        try:
            return await func(*args, **kwargs)
        except ConnectionFailed as exception:
            raise HomeAssistantError(
                translation_domain=DOMAIN, translation_key="connection_failed"
            ) from exception

    return _convert_exception


class ArcamFmjEntity(CoordinatorEntity[ArcamFmjCoordinator]):
    """Base entity for Arcam FMJ."""

    _attr_has_entity_name = True

    def __init__(
        self,
        coordinator: ArcamFmjCoordinator,
        description: EntityDescription | None = None,
    ) -> None:
        """Initialize the entity."""
        super().__init__(coordinator)

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Confirm the AVR is on and reachable, then retry the action.
  2. Fix the receiver's IP (DHCP reservation) or update the integration config if the address changed.
  3. Reload the integration to re-establish the socket if it stays broken.
  4. Check the coordinator's last success to distinguish a dead connection from a transient blip.
Defensive patterns

Strategy: try-catch

Try / catch

In custom entity code, reuse the convert_exception decorator (or catch ConnectionFailed and re-raise HomeAssistantError with translation_domain/translation_key) so UI users get a translated message and the original exception stays chained.

Prevention

When it happens

Trigger: Any decorated entity action (e.g. async_select_source, async_set_volume_level, async_play_media) calls into self._state and the library raises ConnectionFailed because the TCP socket to the AVR is closed or unreachable at that moment.

Common situations: User presses a remote/media-player control while the AVR just went into standby or its IP changed; stale socket after long idle; control connection already claimed elsewhere.

Related errors


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