diff --git a/gazpar2haws/gazpar.py b/gazpar2haws/gazpar.py index b31bb27..1cb52b2 100644 --- a/gazpar2haws/gazpar.py +++ b/gazpar2haws/gazpar.py @@ -182,7 +182,9 @@ async def _find_last_date_days_value( if exists_statistic_id: # Get the last statistic from Home Assistant try: - last_statistic = await self._homeassistant.get_last_statistic(entity_id, self._as_of_date, self._last_days) + last_statistic = await self._homeassistant.get_last_statistic( + entity_id, self._as_of_date, self._last_days + ) except HomeAssistantWSException: Logger.warning( f"Error while fetching last statistics from Home Assistant: {traceback.format_exc()}" diff --git a/gazpar2haws/haws.py b/gazpar2haws/haws.py index 87ffe5e..8f7c64b 100644 --- a/gazpar2haws/haws.py +++ b/gazpar2haws/haws.py @@ -158,7 +158,9 @@ async def statistics_during_period( return response # ---------------------------------- - async def get_last_statistic(self, entity_id: str, as_of_date: datetime, depth_days: int) -> dict: + async def get_last_statistic( + self, entity_id: str, as_of_date: datetime, depth_days: int + ) -> dict: Logger.debug(f"Getting last statistic for {entity_id}...") diff --git a/tests/test_haws.py b/tests/test_haws.py index 87ae87f..16e51e8 100644 --- a/tests/test_haws.py +++ b/tests/test_haws.py @@ -77,7 +77,9 @@ async def test_get_last_statistic(self): await self._haws.connect() - statistics = await self._haws.get_last_statistic("sensor.gazpar2haws_volume", datetime.now(), 30) + statistics = await self._haws.get_last_statistic( + "sensor.gazpar2haws_volume", datetime.now(), 30 + ) assert statistics is not None @@ -109,6 +111,8 @@ async def test_clear_statistics(self): await self._haws.connect() - await self._haws.clear_statistics(["sensor.gazpar2haws_energy", "sensor.gazpar2haws_volume"]) + await self._haws.clear_statistics( + ["sensor.gazpar2haws_energy", "sensor.gazpar2haws_volume"] + ) await self._haws.disconnect()