new endpoints 5
This commit is contained in:
@@ -323,25 +323,12 @@
|
||||
|
||||
try {
|
||||
// Load device info using API client
|
||||
const devicesData = await window.apiClient.getDevices();
|
||||
deviceData = window.apiClient.findDevice(devicesData, deviceId);
|
||||
|
||||
if (!deviceData) {
|
||||
throw new Error(`Gerät "${deviceId}" nicht gefunden`);
|
||||
}
|
||||
|
||||
// Load layout to get room
|
||||
const layoutData = await window.apiClient.getLayout();
|
||||
for (const room of layoutData.rooms) {
|
||||
if (room.devices.includes(deviceId)) {
|
||||
roomName = room.name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Load all device states at once
|
||||
const allStates = await window.apiClient.getAllStates();
|
||||
deviceState = allStates[deviceId] || {};
|
||||
// NEW: Use new endpoints for device info and layout
|
||||
deviceData = await window.apiClient.getDeviceState(deviceId);
|
||||
const layoutInfo = await window.apiClient.getDeviceLayout(deviceId);
|
||||
roomName = layoutInfo.room;
|
||||
// deviceState is now the result of getDeviceState
|
||||
deviceState = deviceData;
|
||||
|
||||
// Update header
|
||||
document.getElementById('device-icon').textContent = deviceIcons[deviceData.type] || '📱';
|
||||
|
||||
Reference in New Issue
Block a user