diff --git a/Actor/app.py b/Actor/app.py index fd79525..c9b55e9 100644 --- a/Actor/app.py +++ b/Actor/app.py @@ -7,7 +7,7 @@ import datetime # Import für Datums- und Zeitstempel # ========================================================== -# KONFIGURATION & DATEIEN +# Teil 1 KONFIGURATION & DATEIEN # ========================================================== CHIP_NAMES_FILE = "data.json" @@ -69,21 +69,18 @@ def load_config(): return True except FileNotFoundError: - # ... (Error Handling bleibt gleich) ... print("❌ KRITISCHER FEHLER: Die Datei data.json wurde nicht gefunden!") print("Bitte erstellen Sie diese Datei und verwenden Sie die korrekte Struktur.") return False except json.JSONDecodeError: - # ... (Error Handling bleibt gleich) ... print(f"❌ KRITISCHER FEHLER: Die Datei {CHIP_NAMES_FILE} ist kein gültiges JSON!") return False except ValueError as e: - # ... (Error Handling bleibt gleich) ... print(f"❌ KONFIGURIERUNGSFEHLER: {e}") return False # ========================================================== -# 💾 Funktion zur Zustandsspeicherung (Speichert Status UND Zeit) +# Teil 2 Funktion zur Zustandsspeicherung (Speichert Status UND Zeit) # ========================================================== def save_state(): @@ -110,7 +107,7 @@ def save_state(): # ========================================================== -# ⚙️ Angepasste Funktion (Status-Update, Logging & Time Stamping) +# Teil 3 Status-Update, Logging & Time Stamping # ========================================================== def update_status(chip_id): @@ -144,7 +141,7 @@ def update_status(chip_id): # ========================================================== -# MQTT LOGIK (Bleibt unverändert) +# Teil 4 MQTT LOGIK # ========================================================== def on_connect(client, userdata, flags, rc): @@ -171,7 +168,6 @@ def on_message(client, userdata, msg): def run_mqtt_client(): """Startet den MQTT-Client im Hintergrundthread.""" - # ... (Code bleibt gleich) ... client = mqtt.Client("RFID_Tracker") client.on_connect = on_connect client.on_message = on_message @@ -184,7 +180,7 @@ def run_mqtt_client(): print(f"\n!!! KRITISCHER FEHLER !!! Broker-Verbindung fehlgeschlagen ({e}). Prüfen Sie die Einstellungen in data.json.") # ========================================================== -# WEB-SERVER LOGIK (Flask) - Bleibt unverändert +# Teil 5 WEB-SERVER LOGIK (Flask) # ========================================================== @app.route('/') diff --git a/Actor/current_status.json b/Actor/current_status.json index ab99608..9da606a 100644 --- a/Actor/current_status.json +++ b/Actor/current_status.json @@ -1,28 +1,29 @@ { + "__comment__": "Alle Registrierten Chips", "chips": [ { "name": "1", "id": "729558387180", "status": "0", - "time_active": "2026-06-10T13:07:21.722653" + "time_active": "2026-06-12T08:22:50.365019" }, { "name": "2", "id": "987572218311", "status": "0", - "time_active": "2026-06-10T13:07:21.722681" + "time_active": "2026-06-12T08:22:50.365048" }, { "name": "3", "id": "842310768930", "status": "0", - "time_active": "2026-06-10T13:07:21.722690" + "time_active": "2026-06-12T08:22:50.365056" }, { "name": "4", "id": "773910059391", - "status": "0", - "time_active": "2026-06-10T13:07:21.722698" + "status": "1", + "time_active": "2026-06-12T08:22:50.365063" } ] } \ No newline at end of file diff --git a/Actor/data.json b/Actor/data.json index 2399401..5c88177 100644 --- a/Actor/data.json +++ b/Actor/data.json @@ -1,15 +1,17 @@ -{ +{ + "__comment__": "Config für MQTT", "mqtt_config": { "broker": "192.168.213.12", "port": 1883, "topic": "RFID" }, + "__comment2__": "Alle Registrierten Chips", "chips": [ { "name": "1", "id": "729558387180", - "status": "0", - "time_active": "" + "status": "1", + "time_active": "2026-06-12T08:22:50.365063" }, { "name": "2", diff --git a/Actor/templates/index.html b/Actor/templates/index.html index 57f8185..f1c58d0 100644 --- a/Actor/templates/index.html +++ b/Actor/templates/index.html @@ -4,7 +4,6 @@