Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion custom_components/smarthashtag/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down
Loading