Panels become devices: per-device documents in the flow repo, a Devices tab

- flow/devices.py: DeviceDef in FLOWS_DIR/_devices/<id>.json, committed under
  the flow store's write lock, 409 on a stale version; nonces in DEVICES_FILE
  outside git; in-memory presence announced as device_status
- api/routes/devices.py: CRUD, pairing with an optional {name, board,
  firmware}, a pending list adopted without a code from the LAN only, unpair;
  /panels/pair, /panels/pair/{code} and GET /panels/{id} kept as aliases,
  PUT /panels/ gone
- _device_may replaces _panel_may, JWT claims unchanged
- panels.json moves into devices once at startup, then .migrated
- MCP list_devices, get_device; search category device
- Devices tab (list, detail with presence, pairing, ordered dashboards,
  touch, I/O), PanelsDialog removed, serialised optimistic saves
This commit is contained in:
Melvin Strobl
2026-10-16 15:48:36 +02:00
parent 3c0912a3fe
commit 28a565e501
56 changed files with 3539 additions and 2404 deletions
+13
View File
@@ -180,6 +180,19 @@ async def list_shared_nodes() -> Any:
return await _call("GET", "/flows/library")
@mcp.tool()
async def list_devices() -> Any:
"""Every paired screen or board, the dashboards it shows and whether it is
connected."""
return await _call("GET", "/devices/")
@mcp.tool()
async def get_device(device_id: str) -> Any:
"""One device: its dashboards in rail order, touch, and its own I/O ports."""
return await _call("GET", f"/devices/{_seg(device_id)}")
@mcp.tool()
async def get_graph() -> Any:
"""Every flow as one graph, with nodes talking to the same thing merged.