{"record":{"id":"c4aac21062b23b6b","repo":"home-assistant/core","slug":"update-error-c4aac2","errorCode":"update_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":"UpdateFailed","httpStatus":null,"severity":"error","filePath":"homeassistant/components/airgradient/coordinator.py","lineNumber":59,"sourceCode":"            hass,\n            logger=LOGGER,\n            config_entry=config_entry,\n            name=f\"AirGradient {client.host}\",\n            update_interval=timedelta(minutes=1),\n        )\n        self.client = client\n        assert self.config_entry.unique_id\n        self.serial_number = self.config_entry.unique_id\n\n    @override\n    async def _async_setup(self) -> None:\n        \"\"\"Set up the coordinator.\"\"\"\n        try:\n            self._current_version = (\n                await self.client.get_current_measures()\n            ).firmware_version\n        except AirGradientError as error:\n            raise UpdateFailed(\n                translation_domain=DOMAIN,\n                translation_key=\"update_error\",\n                translation_placeholders={\"error\": str(error)},\n            ) from error\n\n    @override\n    async def _async_update_data(self) -> AirGradientData:\n        try:\n            measures = await self.client.get_current_measures()\n            config = await self.client.get_config()\n        except AirGradientError as error:\n            raise UpdateFailed(\n                translation_domain=DOMAIN,\n                translation_key=\"update_error\",\n                translation_placeholders={\"error\": str(error)},\n            ) from error\n        if measures.firmware_version != self._current_version:\n            device_registry = dr.async_get(self.hass)","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/airgradient/coordinator.py#L41-L77","documentation":"Raised by the AirGradient DataUpdateCoordinator during _async_setup when the initial client.get_current_measures() call fails with any AirGradientError. It is wrapped in UpdateFailed with translation key update_error so the config entry setup reports the underlying device/library error. This aborts the coordinator's first refresh and marks the entry as setup-failed or retrying.","triggerScenarios":"The first get_current_measures() HTTP request to the AirGradient device (local firmware API, typically http://<ip>/ measures) raises AirGradientError: wrong IP/host, device offline, firmware endpoint returning malformed JSON, or an airgradient library-level error.","commonSituations":"Device got a new DHCP address after router reboot, wrong host in config entry, device running very old firmware without the local API, or the entry was configured with https:// scheme against an http-only local API.","solutions":["Verify the device is reachable: open http://<configured-host>/ measures in a browser or curl it","Fix the host/IP in the config entry (reconfigure) if the device address changed; prefer a static IP or DNS name","Update AirGradient firmware so the local API endpoints exist","If the error persists, check Home Assistant logs for the wrapped `str(error)` detail and network/firewall blocking between HA and the device"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import socket\n\n# before adding the entry, confirm the local API answers\nsock = socket.create_connection((host, 80), timeout=3)\nsock.close()","typeGuard":null,"tryCatchPattern":"try:\n    await coordinator.async_config_entry_first_refresh()\nexcept ConfigEntryNotReady as err:\n    # setup error already wrapped as UpdateFailed -> NotReady; keep entry for retry\n    _LOGGER.warning(\"AirGradient not ready: %s\", err)","preventionTips":["Give the AirGradient device a DHCP reservation or static IP","Confirm http://<host>/ measures responds before adding the integration","Keep device firmware updated so the local API endpoints exist"],"tags":["airgradient","home-assistant","network","coordinator"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}