From eadd23aee1bc01f00118fb2ab15142ea1ee74d08 Mon Sep 17 00:00:00 2001 From: Rik Veenboer Date: Wed, 4 Feb 2026 20:30:37 +0100 Subject: [PATCH] implement healthcheck --- compose.yaml | 5 +++++ src/main.py | 3 +++ 2 files changed, 8 insertions(+) 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