{"record":{"id":"abcd8e0a4f934557","repo":"home-assistant/core","slug":"connection-failed","errorCode":"connection_failed","errorMessage":"Connection failed to the device.","messagePattern":"Connection failed to the device\\.","errorType":"exception","errorClass":"HomeAssistantError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/arcam_fmj/entity.py","lineNumber":27,"sourceCode":"from homeassistant.exceptions import HomeAssistantError\nfrom homeassistant.helpers.entity import EntityDescription\nfrom homeassistant.helpers.update_coordinator import CoordinatorEntity\n\nfrom .const import DOMAIN\nfrom .coordinator import ArcamFmjCoordinator\n\n\ndef convert_exception[**_P, _R](\n    func: Callable[_P, Coroutine[Any, Any, _R]],\n) -> Callable[_P, Coroutine[Any, Any, _R]]:\n    \"\"\"Convert a connection failure into a translated HomeAssistantError.\"\"\"\n\n    @functools.wraps(func)\n    async def _convert_exception(*args: _P.args, **kwargs: _P.kwargs) -> _R:\n        try:\n            return await func(*args, **kwargs)\n        except ConnectionFailed as exception:\n            raise HomeAssistantError(\n                translation_domain=DOMAIN, translation_key=\"connection_failed\"\n            ) from exception\n\n    return _convert_exception\n\n\nclass ArcamFmjEntity(CoordinatorEntity[ArcamFmjCoordinator]):\n    \"\"\"Base entity for Arcam FMJ.\"\"\"\n\n    _attr_has_entity_name = True\n\n    def __init__(\n        self,\n        coordinator: ArcamFmjCoordinator,\n        description: EntityDescription | None = None,\n    ) -> None:\n        \"\"\"Initialize the entity.\"\"\"\n        super().__init__(coordinator)","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/arcam_fmj/entity.py#L9-L45","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the AVR is on and reachable, then retry the action.","Fix the receiver's IP (DHCP reservation) or update the integration config if the address changed.","Reload the integration to re-establish the socket if it stays broken.","Check the coordinator's last success to distinguish a dead connection from a transient blip."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"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.","preventionTips":["Wrap every entity service coroutine that talks to the device with the exception-converting decorator.","Check coordinator.last_update_success before issuing commands.","Reload the integration to rebuild sockets after network changes."],"tags":["home-assistant","arcam-fmj","entity","connection","service-action"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}