feat: add WLED device status check (online/offline, LEDs, version)

- Query WLED JSON API (/json/info) for device info
- Show online/offline status dot, LED count and firmware version
- Auto-check all devices on page load
- Button to manually check individual or all devices
- Fix hostname placeholder to volksheimstaette.de

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 21:57:07 +02:00
co-authored by Claude Opus 4.6
parent bc96fed884
commit 1bf42250b4
3 changed files with 93 additions and 3 deletions
+11
View File
@@ -243,6 +243,17 @@ async def delete_device(device_id: int):
return RedirectResponse("/devices", status_code=303)
@app.get("/api/devices/{device_id}/status")
async def device_status(device_id: int):
from wled_client import get_wled_info
conn = database.get_db()
dev = conn.execute("SELECT hostname FROM wled_devices WHERE id=?", (device_id,)).fetchone()
conn.close()
if not dev:
return {"online": False}
return get_wled_info(dev["hostname"])
# ── Assignments ────────────────────────────────────────────────────────────
@app.get("/assignments", response_class=HTMLResponse)