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