{"record":{"id":"1d653ce20ea12894","repo":"home-assistant/core","slug":"error-communicating-with-api-err-1d653c","errorCode":null,"errorMessage":"Error communicating with API: {err}","messagePattern":"Error communicating with API: (.+?)","errorType":"exception","errorClass":"UpdateFailed","httpStatus":null,"severity":"error","filePath":"homeassistant/components/aquacell/coordinator.py","lineNumber":86,"sourceCode":"\n        async with asyncio.timeout(30):\n            # Check if the refresh token is expired\n            expiry_time = (\n                self.refresh_token_creation_time\n                + REFRESH_TOKEN_EXPIRY_TIME.total_seconds()\n            )\n            try:\n                if time.time() >= expiry_time:\n                    await self._reauthenticate()\n                else:\n                    await self.aquacell_api.authenticate_refresh(self.refresh_token)\n                _LOGGER.debug(\"Logged in using: %s\", self.refresh_token)\n\n                softeners = await self.aquacell_api.get_all_softeners()\n            except AuthenticationFailed as err:\n                raise ConfigEntryAuthFailed from err\n            except (AquacellApiException, TimeoutError) as err:\n                raise UpdateFailed(f\"Error communicating with API: {err}\") from err\n\n        return {softener.dsn: softener for softener in softeners}\n\n    async def _reauthenticate(self) -> None:\n        _LOGGER.debug(\"Attempting to renew refresh token\")\n        refresh_token = await self.aquacell_api.authenticate(self.email, self.password)\n        self.refresh_token = refresh_token\n        data = {\n            **self.config_entry.data,\n            CONF_REFRESH_TOKEN: self.refresh_token,\n            CONF_REFRESH_TOKEN_CREATION_TIME: time.time(),\n        }\n\n        self.hass.config_entries.async_update_entry(self.config_entry, data=data)\n","sourceCodeStart":68,"sourceCodeEnd":101,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/aquacell/coordinator.py#L68-L101","documentation":"UpdateFailed raised by the Aquacell coordinator when fetching softener data raises AquacellApiException or TimeoutError (after a successful token refresh). It signals a transport/server-level failure talking to the Aquacell cloud API; the DataUpdateCoordinator will retry on its schedule and entities keep their last values.","triggerScenarios":"In _async_update_data: refresh-token auth succeeds but aquacell_api.get_all_softeners() raises AquacellApiException (HTTP/cloud error) or TimeoutError; also re-raised when the outer softeners fetch is stale and the re-fetch path fails the same way.","commonSituations":"Aquacell cloud outage or rate limiting; flaky internet/DNS at the HA host; token partially expired causing degraded API behavior; softener offline so the backend errors per-device.","solutions":["Check HA's outbound network (DNS, proxy, firewall) and the Aquacell cloud status; retrying usually resolves transient faults.","If errors repeat every poll, re-authenticate: delete and re-create the Aquacell config entry to force a fresh login (password change/expire is a common cause).","Confirm the refresh token timestamp stored in entry data is current; a clock skew on the host can force the reauthenticate path repeatedly.","Reduce sensor scan interval if the API appears rate-limited."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    softeners = await aquacell_api.get_all_softeners()\nexcept TimeoutError:\n    raise UpdateFailed(\"Error communicating with API: timeout\") from None","preventionTips":["Ensure reliable outbound internet and DNS on the HA host.","If auth failures begin to appear instead, re-create the config entry to refresh credentials.","Do not wrap coordinator updates in custom retry loops that bypass ConfigEntryAuthFailed semantics."],"tags":["home-assistant","aquacell","water-softener","coordinator","api","timeout"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}