From 4b4cb9217bdc9c74e2627e9e45caead35d51d24b Mon Sep 17 00:00:00 2001 From: Christian Gonzalvez <32960017+chriscatuk@users.noreply.github.com> Date: Sun, 5 Jul 2026 16:44:36 +0200 Subject: [PATCH] Increase vehicle data refresh timeout from 10s to 30s My integration showed the car as unavailable almost permanently for the past few weeks. After checking the logs, the main culprit was timeouts: increasing the timeout shows the full data fetch actually takes ~21s. It's a long chain of sequential calls to Smart's cloud (vehicle status -> OTA info -> journal authorisation -> trip journal -> ...). The old 10s timeout tripped asyncio.timeout -> UpdateFailed -> entities went unavailable even when the API was healthy. Raise the timeout to 30s via a named API_TIMEOUT constant. --- custom_components/smarthashtag/coordinator.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/custom_components/smarthashtag/coordinator.py b/custom_components/smarthashtag/coordinator.py index cb17365..230f838 100644 --- a/custom_components/smarthashtag/coordinator.py +++ b/custom_components/smarthashtag/coordinator.py @@ -21,6 +21,10 @@ # Set high enough to tolerate multiple internal API calls failing within a single refresh MAX_TRANSIENT_FAILURES = 10 +# Timeout (seconds) for a full vehicle data refresh. A healthy refresh is a +# chain of sequential Smart/Geely cloud calls that can legitimately take ~20s. +API_TIMEOUT = 30 + # https://developers.home-assistant.io/docs/integration_fetching_data#coordinated-single-api-poll-for-data-for-all-entities class SmartHashtagDataUpdateCoordinator(DataUpdateCoordinator): @@ -101,7 +105,7 @@ async def _async_update_data(self): UpdateFailed: If a SmartRemoteServiceError is raised during the data retrieval. """ try: - async with asyncio.timeout(10): + async with asyncio.timeout(API_TIMEOUT): await self.account.get_vehicles() # Reset failure counter on success if self._consecutive_failures > 0: