From e148f89d0cbfe486b4bdc4cc9b5b6ebaec5c1c3a Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Tue, 29 Nov 2022 08:31:15 +0100 Subject: [PATCH] RPI: fix sleep calculation by using the correct (utc) time --- tools/rpi/hoymiles/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/rpi/hoymiles/__main__.py b/tools/rpi/hoymiles/__main__.py index 18e3d95e..69bf1479 100644 --- a/tools/rpi/hoymiles/__main__.py +++ b/tools/rpi/hoymiles/__main__.py @@ -62,7 +62,7 @@ class SunsetHandler: tomorrow = now + timedelta(days=1) nextSunrise = self.suntimes.riseutc(tomorrow) self.nextSunset = self.suntimes.setutc(tomorrow) - time_to_sleep = int((nextSunrise - datetime.now()).total_seconds()) + time_to_sleep = int((nextSunrise - datetime.utcnow()).total_seconds()) logging.info (f'Waiting for sunrise at {nextSunrise} UTC ({time_to_sleep} seconds)') if time_to_sleep > 0: time.sleep(time_to_sleep)