home-assistant/core · error · UpdateFailed
update_error
update_error
Error message
An error occurred while communicating with the Airgradient device: {error} What it means
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.
Source
Thrown at homeassistant/components/airgradient/coordinator.py:59
hass,
logger=LOGGER,
config_entry=config_entry,
name=f"AirGradient {client.host}",
update_interval=timedelta(minutes=1),
)
self.client = client
assert self.config_entry.unique_id
self.serial_number = self.config_entry.unique_id
@override
async def _async_setup(self) -> None:
"""Set up the coordinator."""
try:
self._current_version = (
await self.client.get_current_measures()
).firmware_version
except AirGradientError as error:
raise UpdateFailed(
translation_domain=DOMAIN,
translation_key="update_error",
translation_placeholders={"error": str(error)},
) from error
@override
async def _async_update_data(self) -> AirGradientData:
try:
measures = await self.client.get_current_measures()
config = await self.client.get_config()
except AirGradientError as error:
raise UpdateFailed(
translation_domain=DOMAIN,
translation_key="update_error",
translation_placeholders={"error": str(error)},
) from error
if measures.firmware_version != self._current_version:
device_registry = dr.async_get(self.hass)View on GitHub (pinned to 58a3fdb3ea)
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
Defensive patterns
Strategy: retry
Validate before calling
import socket # before adding the entry, confirm the local API answers sock = socket.create_connection((host, 80), timeout=3) sock.close()
Try / catch
try:
await coordinator.async_config_entry_first_refresh()
except ConfigEntryNotReady as err:
# setup error already wrapped as UpdateFailed -> NotReady; keep entry for retry
_LOGGER.warning("AirGradient not ready: %s", err) Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unable find multi-factor auth module: {mfa_module_id}
- communication_error
- Failed to communicate with device.
- Failed to connect
- Airtouch connection issue
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/c4aac21062b23b6b.
Report an issue: GitHub.