{"record":{"id":"de0e8d4c1e0f68b2","repo":"home-assistant/core","slug":"communication-error","errorCode":"communication_error","errorMessage":"An error occurred while communicating with the Airgradient device: {error}","messagePattern":"An error occurred while communicating with the Airgradient device: (.+?)","errorType":"exception","errorClass":"HomeAssistantError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/airgradient/entity.py","lineNumber":49,"sourceCode":"            serial_number=coordinator.serial_number,\n            sw_version=measures.firmware_version,\n            connections={(dr.CONNECTION_NETWORK_MAC, coordinator.serial_number)},\n        )\n\n\ndef exception_handler[_EntityT: AirGradientEntity, **_P](\n    func: Callable[Concatenate[_EntityT, _P], Coroutine[Any, Any, Any]],\n) -> Callable[Concatenate[_EntityT, _P], Coroutine[Any, Any, None]]:\n    \"\"\"Decorate AirGradient calls to handle exceptions.\n\n    A decorator that wraps the passed in function, catches AirGradient errors.\n    \"\"\"\n\n    async def handler(self: _EntityT, *args: _P.args, **kwargs: _P.kwargs) -> None:\n        try:\n            await func(self, *args, **kwargs)\n        except AirGradientConnectionError as error:\n            raise HomeAssistantError(\n                translation_domain=DOMAIN,\n                translation_key=\"communication_error\",\n                translation_placeholders={\"error\": str(error)},\n            ) from error\n\n        except AirGradientError as error:\n            raise HomeAssistantError(\n                translation_domain=DOMAIN,\n                translation_key=\"unknown_error\",\n                translation_placeholders={\"error\": str(error)},\n            ) from error\n\n    return handler\n","sourceCodeStart":31,"sourceCodeEnd":63,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/airgradient/entity.py#L31-L63","documentation":"Raised by the exception_handler decorator used on AirGradient entity service methods (e.g. setting fan speed or configuration attributes). When the underlying library call raises AirGradientConnectionError, it is re-raised as HomeAssistantError with translation key communication_error, so the user sees a clean, translated message in the service-call UI instead of a raw traceback.","triggerScenarios":"Any entity action (config/fan/number services) on an AirGradient entity where the HTTP request to the device fails at the transport level: connection refused, timeout, DNS failure — anything the airgradient library classifies as AirGradientConnectionError.","commonSituations":"Pressing a control button while the device is powered off or unreachable, wrong IP after network changes, or HA and device on separated VLANs.","solutions":["Verify device reachability from the HA host (ping / curl the device)","Correct the host in the AirGradient config entry via reconfigure","Fix network segmentation/firewall rules so HA can reach the device","Retry the service call once the device responds"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from homeassistant.exceptions import HomeAssistantError\n\ntry:\n    await hass.services.async_call(DOMAIN, \"set_fan_speed\", {...}, blocking=True)\nexcept HomeAssistantError as err:\n    # translation key communication_error: device unreachable; check host/network\n    _LOGGER.warning(\"AirGradient command failed: %s\", err)","preventionTips":["Verify device reachability before running automations that control it","Alert on the entity being unavailable rather than catching per-call","Use static IP/DNS for the device"],"tags":["airgradient","home-assistant","entity-action","network"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}