dev #1

Merged
alientim merged 145 commits from dev into main 2025-10-12 13:44:14 +02:00
Showing only changes of commit cce1de034a - Show all commits

View File

@@ -207,6 +207,15 @@ def devices():
# --- Prüfen, ob es sich um eine Switch-Änderung handelt --- # --- Prüfen, ob es sich um eine Switch-Änderung handelt ---
if mac is None and rpi_ip is None and port is None and name is None and switch_hostname: if mac is None and rpi_ip is None and port is None and name is None and switch_hostname:
# Nur den Switch ändern # Nur den Switch ändern
device = conn.execute("SELECT name, switch_hostname FROM devices WHERE mac=?", (old_mac,)).fetchone()
if not device:
flash("Gerät nicht gefunden!")
return redirect(url_for('devices'))
old_switch = device['switch_hostname'] or "unbekannt"
device_name = device['name']
try: try:
conn.execute(""" conn.execute("""
UPDATE devices UPDATE devices
@@ -214,7 +223,7 @@ def devices():
WHERE mac=? WHERE mac=?
""", (switch_hostname, old_mac)) """, (switch_hostname, old_mac))
conn.commit() conn.commit()
flash("Switch wurde geändert.") flash(f"Switch von '{device_name}' geändert: {old_switch}{switch_hostname}")
except sqlite3.IntegrityError: except sqlite3.IntegrityError:
flash("Fehler beim Ändern des Switch!") flash("Fehler beim Ändern des Switch!")
return redirect(url_for('devices')) return redirect(url_for('devices'))