From be80f6bb714e23ab592a4f62be35e7ecfe3c4622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Gir=C3=B3n?= Date: Tue, 29 Oct 2024 17:06:52 +0100 Subject: [PATCH] fix: consumptions not received (#30) * fix: check date to max today * bump version --- custom_components/aigues_barcelona/manifest.json | 2 +- custom_components/aigues_barcelona/sensor.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/custom_components/aigues_barcelona/manifest.json b/custom_components/aigues_barcelona/manifest.json index 41fbd72..31d497b 100644 --- a/custom_components/aigues_barcelona/manifest.json +++ b/custom_components/aigues_barcelona/manifest.json @@ -14,5 +14,5 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/duhow/hass-aigues-barcelona/issues", "requirements": [], - "version": "0.4.2" + "version": "0.4.3" } diff --git a/custom_components/aigues_barcelona/sensor.py b/custom_components/aigues_barcelona/sensor.py index 0a4b240..8d985d6 100644 --- a/custom_components/aigues_barcelona/sensor.py +++ b/custom_components/aigues_barcelona/sensor.py @@ -135,7 +135,6 @@ async def _async_update_data(self): _LOGGER.info(f"Updating coordinator data for {self.contract}") TODAY = datetime.now() LAST_WEEK = TODAY - timedelta(days=7) - TOMORROW = TODAY + timedelta(days=1) try: previous = datetime.fromisoformat(self._data.get(CONF_STATE, "")) @@ -155,7 +154,7 @@ async def _async_update_data(self): # TODO: change once recaptcha is fiexd # await self.hass.async_add_executor_job(self._api.login) consumptions = await self.hass.async_add_executor_job( - self._api.consumptions, LAST_WEEK, TOMORROW, self.contract + self._api.consumptions, LAST_WEEK, TODAY, self.contract ) except ConfigEntryAuthFailed as exp: _LOGGER.error("Token has expired, cannot check consumptions.")