feat: implement command status update and enhance MQTT message handling

This commit is contained in:
derlole
2025-05-08 13:26:43 +00:00
parent c3d27b9e37
commit 20fa37b0d9
6 changed files with 54 additions and 14 deletions

22
modules/db.py Normal file
View File

@@ -0,0 +1,22 @@
import sqlite3
import os
from datetime import datetime, timedelta
DB_PATH = os.path.join(os.path.dirname(__file__), '../db/commands.db')
### THIS CODE IS NOT PROOFED BUT LOOKS RIGHT###
def update_command_status(command_id, status):
conn = sqlite3.connect(DB_PATH)
cursor = conn.cursor()
cursor.execute("""
UPDATE commands
SET status = ?
WHERE command_id = ?
""", (status, command_id))
conn.commit()
conn.close()
print(f"[DB] Befehl {command_id} auf {status} aktualisiert.")
return status
### THIS CODE IS NOT PROOFED BUT LOOKS RIGHT###