1
mirror of https://github.com/home-assistant/core synced 2024-07-15 09:42:11 +02:00

Hotfix cache logic bug in Tessie (#107187)

This commit is contained in:
Brett Adams 2024-01-05 17:23:43 +10:00 committed by GitHub
parent 298e2e2b99
commit ace4edf91c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,7 +41,6 @@ class TessieStateUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
self.vin = vin
self.session = async_get_clientsession(hass)
self.data = self._flatten(data)
self.did_first_update = False
async def _async_update_data(self) -> dict[str, Any]:
"""Update vehicle data using Tessie API."""
@ -50,7 +49,7 @@ class TessieStateUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
session=self.session,
api_key=self.api_key,
vin=self.vin,
use_cache=self.did_first_update,
use_cache=False,
)
except ClientResponseError as e:
if e.status == HTTPStatus.UNAUTHORIZED:
@ -58,7 +57,6 @@ class TessieStateUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
raise ConfigEntryAuthFailed from e
raise e
self.did_first_update = True
if vehicle["state"] == TessieStatus.ONLINE:
# Vehicle is online, all data is fresh
return self._flatten(vehicle)