From 1f246da94300a271637aae34cf36605be21fa641 Mon Sep 17 00:00:00 2001 From: Jakob Schlyter Date: Mon, 11 Nov 2024 07:18:05 +0100 Subject: [PATCH] log when odometer/battery has been updated --- custom_components/polestar_api/pypolestar/polestar.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/custom_components/polestar_api/pypolestar/polestar.py b/custom_components/polestar_api/pypolestar/polestar.py index 218a2a0..e6c3d3a 100644 --- a/custom_components/polestar_api/pypolestar/polestar.py +++ b/custom_components/polestar_api/pypolestar/polestar.py @@ -203,11 +203,13 @@ async def _get_odometer_data(self, vin: str) -> None: variable_values={"vin": vin}, ) - self.cache_data_by_vin[vin][ODO_METER_DATA] = { + res = self.cache_data_by_vin[vin][ODO_METER_DATA] = { "data": result[ODO_METER_DATA], "timestamp": datetime.now(), } + self.logger.debug("Received odometer data: %s", res) + async def _get_battery_data(self, vin: str) -> None: result = await self._query_graph_ql( url=BASE_URL_V2, @@ -215,11 +217,13 @@ async def _get_battery_data(self, vin: str) -> None: variable_values={"vin": vin}, ) - self.cache_data_by_vin[vin][BATTERY_DATA] = { + res = self.cache_data_by_vin[vin][BATTERY_DATA] = { "data": result[BATTERY_DATA], "timestamp": datetime.now(), } + self.logger.debug("Received battery data: %s", res) + async def _get_vehicle_data(self, verbose: bool = False) -> dict | None: """Get the latest vehicle data from the Polestar API.""" result = await self._query_graph_ql(