From 3fa274e34294fc9498e42b8ff199bb0c4d2b9035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Sch=C3=BCller?= Date: Sun, 11 Jun 2023 09:21:07 +0200 Subject: [PATCH] Fix suntimes working if mqtt is enabled but suntimes is disabled --- 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 3589de1a..9dab5d3c 100644 --- a/tools/rpi/hoymiles/__main__.py +++ b/tools/rpi/hoymiles/__main__.py @@ -101,7 +101,7 @@ class SunsetHandler: logging.info (f'Woke up...') def sun_status2mqtt(self, dtu_ser, dtu_name): - if not mqtt_client: + if not mqtt_client or not self.suntimes: return local_sunrise = self.suntimes.riselocal(datetime.now()).strftime("%d.%m.%YT%H:%M") local_sunset = self.suntimes.setlocal(datetime.now()).strftime("%d.%m.%YT%H:%M")