srv/poe_manager/app.py aktualisiert

This commit is contained in:
2025-10-12 15:20:21 +02:00
parent a26a91ec5a
commit 34ef2c4e2a

View File

@@ -104,9 +104,13 @@ def index():
latest_log = max(log_files, key=os.path.getctime)
with open(latest_log, "r") as f:
for line in f:
line = line.strip()
for dev in devices:
if dev[1] in line:
status_dict[dev[0]] = "online" if "erreichbar" in line else "offline"
# exakte Prüfung, Name gefolgt von 'ist erreichbar!' oder 'ist nicht erreichbar!'
if line.startswith(f"{dev[1]} ist erreichbar!"):
status_dict[dev[0]] = "online"
elif line.startswith(f"{dev[1]} ist nicht erreichbar!"):
status_dict[dev[0]] = "offline"
# Template rendern mit Devices, Status und Intervall
return render_template("index.html", devices=devices, status=status_dict, interval=interval)