new endpoints 4
This commit is contained in:
@@ -217,16 +217,15 @@ app.add_middleware(
|
||||
async def get_device_layout(device_id: str):
|
||||
"""Gibt die layout-spezifischen Informationen für ein einzelnes Gerät zurück."""
|
||||
layout = load_layout()
|
||||
for room in layout.get("rooms", []):
|
||||
for device in room.get("devices", []):
|
||||
if device.get("device_id") == device_id:
|
||||
# Rückgabe: Layout-Infos + Raumname
|
||||
for room in layout.rooms:
|
||||
for device in room.devices:
|
||||
if device.device_id == device_id:
|
||||
return {
|
||||
"device_id": device_id,
|
||||
"room": room.get("name"),
|
||||
"title": device.get("title"),
|
||||
"icon": device.get("icon"),
|
||||
"rank": device.get("rank"),
|
||||
"room": room.name,
|
||||
"title": device.title,
|
||||
"icon": device.icon,
|
||||
"rank": device.rank,
|
||||
}
|
||||
raise HTTPException(status_code=404, detail="Device layout not found")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user