From 7346b2086c9e0ee5a0ceb21311f48e2fa7067ed8 Mon Sep 17 00:00:00 2001 From: skurz Date: Fri, 8 Nov 2024 18:10:36 +0100 Subject: [PATCH] convert evu_days of type string to list --- custom_components/luxtronik/sensor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/custom_components/luxtronik/sensor.py b/custom_components/luxtronik/sensor.py index 335136c..163205e 100644 --- a/custom_components/luxtronik/sensor.py +++ b/custom_components/luxtronik/sensor.py @@ -396,8 +396,10 @@ def _calc_next_evu_event_minutes(self) -> int | None: return None evu_hours = (24 if evu_time < time_now else 0) + evu_time.hour weekday = datetime.today().weekday() - if not isinstance(self._attr_cache[SA.EVU_DAYS], list): - self._attr_cache[SA.EVU_DAYS] = list() + if isinstance(self._attr_cache[SA.EVU_DAYS], str): + self._attr_cache[SA.EVU_DAYS] = self._attr_cache[SA.EVU_DAYS].split(',') + elif not isinstance(self._attr_cache[SA.EVU_DAYS], list): + self._attr_cache[SA.EVU_DAYS] = list() evu_pause = 0 if not self._attr_cache[SA.EVU_DAYS] and weekday not in self._attr_cache[SA.EVU_DAYS]: evu_pause += (24 - datetime.now().hour)*60 - datetime.now().minute