feat: show WLED MAC address on Tuerschilder page

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Christian Mueller 2026-04-24 11:36:45 +02:00
parent 77ae7b357d
commit 9716dfd9bb
4 changed files with 11 additions and 3 deletions

3
app.py
View File

@ -282,11 +282,12 @@ async def check_single_device(device_id: int):
from datetime import datetime
info = get_wled_info(dev["hostname"])
conn.execute("""
UPDATE wled_devices SET online=?, leds=?, version=?, last_check=? WHERE id=?
UPDATE wled_devices SET online=?, leds=?, version=?, mac=?, last_check=? WHERE id=?
""", (
1 if info.get("online") else 0,
info.get("leds", 0) if info.get("online") else 0,
info.get("version", "") if info.get("online") else "",
info.get("mac", "") if info.get("online") else "",
datetime.now(), device_id,
))
conn.commit()

View File

@ -94,6 +94,10 @@ def init_db():
conn.execute("ALTER TABLE wled_devices ADD COLUMN last_check TIMESTAMP")
except Exception:
pass
try:
conn.execute("ALTER TABLE wled_devices ADD COLUMN mac TEXT DEFAULT ''")
except Exception:
pass
try:
conn.execute("ALTER TABLE users ADD COLUMN phone_extension TEXT DEFAULT ''")
except Exception:

View File

@ -210,12 +210,13 @@ def check_devices():
info = get_wled_info(dev["hostname"])
conn.execute("""
UPDATE wled_devices
SET online=?, leds=?, version=?, last_check=?
SET online=?, leds=?, version=?, mac=?, last_check=?
WHERE id=?
""", (
1 if info.get("online") else 0,
info.get("leds", 0) if info.get("online") else 0,
info.get("version", "") if info.get("online") else "",
info.get("mac", "") if info.get("online") else "",
datetime.now(),
dev["id"],
))

View File

@ -29,6 +29,7 @@
<th>Name</th>
<th>LEDs</th>
<th>Version</th>
<th>MAC</th>
<th>Letzte Aktivitaet</th>
<th>Segmente</th>
<th>Aktionen</th>
@ -54,6 +55,7 @@
<td>{{ device.name }}</td>
<td>{{ device.leds if device.leds else '-' }}</td>
<td>{{ device.version if device.version else '-' }}</td>
<td><small class="font-monospace">{{ device.mac if device.mac else '-' }}</small></td>
<td><small>{{ device.last_activity or '-' }}</small></td>
<td>{{ device.segment_count }}</td>
<td>
@ -114,7 +116,7 @@
{% if not devices %}
<tr>
<td colspan="8" class="text-center text-muted py-4">
<td colspan="9" class="text-center text-muted py-4">
Noch keine Tuerschilder vorhanden.
</td>
</tr>