From 2d4d101624f22e4fc54ba900e01860861667e586 Mon Sep 17 00:00:00 2001 From: virtualdj Date: Fri, 3 Nov 2023 18:38:19 +0100 Subject: [PATCH] Fix #16 --- custom_components/pun_sensor/__init__.py | 4 ++-- custom_components/pun_sensor/manifest.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/custom_components/pun_sensor/__init__.py b/custom_components/pun_sensor/__init__.py index 1f255c1..7fd7d74 100644 --- a/custom_components/pun_sensor/__init__.py +++ b/custom_components/pun_sensor/__init__.py @@ -437,9 +437,9 @@ def get_fascia(dataora: datetime) -> Tuple[int, datetime]: fascia = 3 # Prossima fascia: alle 7 di un giorno non domenica o festività - prossima = (dataora + timedelta(days=1)).replace(hour=7, + prossima = dataora.replace(hour=7, minute=0, second=0, microsecond=0) - while ((prossima in holidays.IT()) or (prossima.weekday() == 6)): + while ((prossima <= dataora) or (prossima in holidays.IT()) or (prossima.weekday() == 6)): prossima += timedelta(days=1) else: diff --git a/custom_components/pun_sensor/manifest.json b/custom_components/pun_sensor/manifest.json index fa62479..ebfaf0d 100644 --- a/custom_components/pun_sensor/manifest.json +++ b/custom_components/pun_sensor/manifest.json @@ -10,5 +10,5 @@ "issue_tracker": "https://github.com/virtualdj/pun_sensor/issues", "loggers": ["pun_sensor"], "requirements": ["holidays", "bs4"], - "version": "0.4.0" + "version": "0.4.1" }