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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user