home-assistant/core · error · UpdateFailed

Error communicating with AirPatrol API: {api_err}

Error message

Error communicating with AirPatrol API: {api_err}

What it means

UpdateFailed raised in AirPatrolDataUpdateCoordinator._async_setup when initial client setup (authentication/client construction) raises any AirPatrolError. It aborts config entry setup with 'Error communicating with AirPatrol API: <detail>' and Home Assistant will retry setup with backoff.

Source

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

    api: AirPatrolAPI

    def __init__(self, hass: HomeAssistant, config_entry: AirPatrolConfigEntry) -> None:
        """Initialize."""

        super().__init__(
            hass,
            LOGGER,
            name=f"{DOMAIN.capitalize()} {config_entry.title}",
            update_interval=SCAN_INTERVAL,
            config_entry=config_entry,
        )

    @override
    async def _async_setup(self) -> None:
        try:
            await self._setup_client()
        except AirPatrolError as api_err:
            raise UpdateFailed(
                f"Error communicating with AirPatrol API: {api_err}"
            ) from api_err

    @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()

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Verify AirPatrol cloud service status and that the app can log in.
  2. Check Home Assistant outbound internet and DNS resolution.
  3. Validate the email/password configured in the entry.
  4. Update the airpatrol integration/library to the latest version.
  5. Look at the wrapped api_err message in logs for the API-level cause.
Defensive patterns

Strategy: try-catch

Type guard

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

Try / catch

try:
    await coordinator.async_config_entry_first_refresh()
except ConfigEntryNotReady as err:
    # setup-time AirPatrolError surfaces as NotReady; HA retries automatically
    raise

Prevention

When it happens

Trigger: _setup_client() raises AirPatrolError (but not AirPatrolAuthenticationError handling — any error during authenticate() or client construction), e.g. the AirPatrol cloud API being unreachable, returning malformed responses, or rate-limiting during setup.

Common situations: AirPatrol cloud outage, wrong email/password causing a non-auth-typed error, network/DNS issues from the Home Assistant host, or API endpoint changes in the airpatrol library.

Related errors


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