implement healthcheck

This commit is contained in:
2026-02-04 20:30:37 +01:00
parent 3bebea717d
commit eadd23aee1
2 changed files with 8 additions and 0 deletions

View File

@@ -13,3 +13,8 @@ services:
network_mode: host network_mode: host
extra_hosts: extra_hosts:
- "host:${HOST_IP}" - "host:${HOST_IP}"
healthcheck:
test: ["CMD-SHELL", "find /tmp/healthy -mmin -11 | grep -q . || exit 1"]
interval: 30s
timeout: 5s
retries: 3

View File

@@ -10,6 +10,7 @@ import backoff
from suntime import Sun from suntime import Sun
import goodwe import goodwe
import paho.mqtt.client as mqtt import paho.mqtt.client as mqtt
from pathlib import Path
# ----------------------------- # -----------------------------
# CONFIGURATION # CONFIGURATION
@@ -125,6 +126,8 @@ async def main_loop():
return await goodwe.connect(ip) return await goodwe.connect(ip)
while True: while True:
Path("/tmp/healthy").touch()
if not is_operational_hours(): if not is_operational_hours():
mqtt_log.info("Outside operational hours (Night). Sleeping 10m.") mqtt_log.info("Outside operational hours (Night). Sleeping 10m.")
active_inverter = None active_inverter = None