implement healthcheck
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user