From 3e02decc02e214968d66463da021c1fe9eb3bf51 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Tue, 18 Nov 2025 11:02:03 +0100 Subject: [PATCH] new endpoints 6 --- apps/ui/templates/room.html | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/apps/ui/templates/room.html b/apps/ui/templates/room.html index b225285..8183a37 100644 --- a/apps/ui/templates/room.html +++ b/apps/ui/templates/room.html @@ -289,15 +289,14 @@ return; } - // Load all device states at once - // NEW: Use device state endpoint for each device - // Fallback: load all states as before - const allStates = await window.apiClient.getAllStates(); - // Example: For each device in room.devices, you could fetch state via - // await window.apiClient.getDeviceState(device_id); - roomDevices.forEach(device => { - deviceStates[device.device_id] = allStates[device.device_id] || null; - }); + // Lade nur die States für die Geräte im aktuellen Raum + for (const device of roomDevices) { + try { + deviceStates[device.device_id] = await window.apiClient.getDeviceState(device.device_id); + } catch (err) { + deviceStates[device.device_id] = null; + } + } // Render devices grid.style.display = 'grid';