diff --git a/compose.yaml b/compose.yaml index 9abc375..e19cba1 100644 --- a/compose.yaml +++ b/compose.yaml @@ -13,3 +13,8 @@ services: network_mode: host extra_hosts: - "host:${HOST_IP}" + healthcheck: + test: ["CMD-SHELL", "find /tmp/healthy -mmin -11 | grep -q . || exit 1"] + interval: 30s + timeout: 5s + retries: 3 diff --git a/src/main.py b/src/main.py index 5ff8c99..7af2282 100644 --- a/src/main.py +++ b/src/main.py @@ -10,6 +10,7 @@ import backoff from suntime import Sun import goodwe import paho.mqtt.client as mqtt +from pathlib import Path # ----------------------------- # CONFIGURATION @@ -125,6 +126,8 @@ async def main_loop(): return await goodwe.connect(ip) while True: + Path("/tmp/healthy").touch() + if not is_operational_hours(): mqtt_log.info("Outside operational hours (Night). Sleeping 10m.") active_inverter = None