Dokumentations anpassungen.

This commit is contained in:
Tim
2026-06-12 10:39:43 +02:00
parent 1096bea997
commit 62f6c697c4
4 changed files with 16 additions and 18 deletions
+5 -9
View File
@@ -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('/')
+6 -5
View File
@@ -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"
}
]
}
+4 -2
View File
@@ -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",
-1
View File
@@ -4,7 +4,6 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RFID Status Tracker</title>
<!-- (Ihr gesamter CSS Block bleibt hier unverändert) -->
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;