new endpoints 6
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user