home-assistant/core · error · UpdateFailed

Error communicating with AirPatrol API: {err}

Error message

Error communicating with AirPatrol API: {err}

What it means

UpdateFailed raised when get_data() raises an AirPatrolError that is not an authentication error — the generic API communication failure path during coordinator updates. Entities go unavailable and the coordinator retries on its schedule.

Source

Thrown at homeassistant/components/airpatrol/coordinator.py:62

    @override
    async def _async_update_data(self) -> dict[str, dict[str, Any]]:
        """Update unit data from AirPatrol API."""
        return {unit_data["unit_id"]: unit_data for unit_data in await self._get_data()}

    async def _get_data(self, retry: bool = False) -> list[dict[str, Any]]:
        """Fetch data from API."""
        try:
            return await self.api.get_data()
        except AirPatrolAuthenticationError as auth_err:
            if retry:
                raise ConfigEntryAuthFailed(
                    "Authentication with AirPatrol failed"
                ) from auth_err
            await self._update_token()
            return await self._get_data(retry=True)
        except AirPatrolError as err:
            raise UpdateFailed(
                f"Error communicating with AirPatrol API: {err}"
            ) from err

    async def _update_token(self) -> None:
        """Refresh the AirPatrol API client and update the access token."""
        session = async_get_clientsession(self.hass)
        try:
            self.api = await AirPatrolAPI.authenticate(
                session,
                self.config_entry.data[CONF_EMAIL],
                self.config_entry.data[CONF_PASSWORD],
            )
        except AirPatrolAuthenticationError as auth_err:
            raise ConfigEntryAuthFailed(
                "Authentication with AirPatrol failed"
            ) from auth_err

        self.hass.config_entries.async_update_entry(

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Check whether the AirPatrol app/cloud is also failing (service-side incident).
  2. Verify Home Assistant internet connectivity.
  3. Reduce polling frequency if rate limiting is suspected (adjust SCAN_INTERVAL).
  4. Wait for coordinator retry — transient API errors self-heal.
  5. Update the airpatrol library if the API contract changed.
Defensive patterns

Strategy: retry

Type guard

def is_airpatrol_api_error(err: Exception) -> bool:
    return isinstance(err, UpdateFailed) and str(err).startswith("Error communicating with AirPatrol API")

Try / catch

try:
    data = await coordinator.async_data()
except UpdateFailed as err:
    if not isinstance(err.__cause__, AirPatrolAuthenticationError):
        # transient API failure: back off and let the coordinator retry
        await asyncio.sleep(coordinator.update_interval.total_seconds())

Prevention

When it happens

Trigger: api.get_data() raises AirPatrolError: HTTP 5xx from the cloud, network timeouts, malformed JSON, or rate limiting after the single auth-retry logic declines to retry non-auth errors.

Common situations: AirPatrol cloud instability, too-frequent polling hitting rate limits, transient internet outages, or breaking API changes after a provider-side update.

Related errors


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