new endpoints 5
This commit is contained in:
@@ -241,8 +241,11 @@
|
||||
|
||||
try {
|
||||
// Load layout and devices using API client
|
||||
// NEW: Use device layout endpoint for each device in this room
|
||||
const layoutData = await window.apiClient.getLayout();
|
||||
const devicesData = await window.apiClient.getDevices();
|
||||
// Example: For each device in room.devices, you could fetch layout info via
|
||||
// await window.apiClient.fetch(window.apiClient.api(`/devices/${device_id}/layout`));
|
||||
|
||||
console.log('Room name from URL:', roomName);
|
||||
console.log('Available rooms:', layoutData.rooms.map(r => r.name));
|
||||
@@ -287,7 +290,11 @@
|
||||
}
|
||||
|
||||
// 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;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user