From 2afb44c1f60800f07daff503475cf010708fb079 Mon Sep 17 00:00:00 2001 From: skurz Date: Thu, 10 Oct 2024 00:20:55 +0200 Subject: [PATCH] restore single day entries --- custom_components/luxtronik/sensor.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/custom_components/luxtronik/sensor.py b/custom_components/luxtronik/sensor.py index 1b4e60c..ab7b8da 100644 --- a/custom_components/luxtronik/sensor.py +++ b/custom_components/luxtronik/sensor.py @@ -449,18 +449,18 @@ def _wd_txt(self, value: list) -> str: return ','.join(days) def _restore_attr_value(self, value: Any | None) -> Any: - if value is not None: - if ',' in str(value): - vals = list() - for day in str(value).split(","): - for idx, name in enumerate(calendar.day_name): - if day == name: - vals.append(idx) - break - return vals + if value is not None: if ":" in str(value): vals = str(value).split(":") return time(int(vals[0]), int(vals[1])) + vals = list() + for day in str(value).split(","): + for idx, name in enumerate(calendar.day_name): + if day == name: + vals.append(idx) + break + if len(vals): + return vals return time.min