diff --git a/srv/poe_manager/app.py b/srv/poe_manager/app.py index 865ce6a..2cd71a9 100644 --- a/srv/poe_manager/app.py +++ b/srv/poe_manager/app.py @@ -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)