new ui 10
This commit is contained in:
@@ -246,7 +246,10 @@ class HomeAutomationClient {
|
|||||||
const deviceMap = {};
|
const deviceMap = {};
|
||||||
devices.forEach(d => deviceMap[d.device_id] = d);
|
devices.forEach(d => deviceMap[d.device_id] = d);
|
||||||
|
|
||||||
return room.devices
|
// Extract device IDs from room.devices (they are objects with device_id property)
|
||||||
|
const deviceIds = room.devices.map(d => d.device_id || d);
|
||||||
|
|
||||||
|
return deviceIds
|
||||||
.map(id => deviceMap[id])
|
.map(id => deviceMap[id])
|
||||||
.filter(d => d != null);
|
.filter(d => d != null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
/**
|
/**
|
||||||
* @typedef {Object} Room
|
* @typedef {Object} Room
|
||||||
* @property {string} name - Room name (e.g., "Küche", "Wohnzimmer")
|
* @property {string} name - Room name (e.g., "Küche", "Wohnzimmer")
|
||||||
* @property {string[]} devices - Array of device IDs in this room
|
* @property {Array<{device_id: string, title: string, icon: string, rank: number}>} devices - Array of device objects in this room
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -264,8 +264,12 @@
|
|||||||
deviceMap[device.device_id] = device;
|
deviceMap[device.device_id] = device;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Extract device IDs from room devices (they are objects now)
|
||||||
|
const deviceIds = room.devices.map(d => d.device_id);
|
||||||
|
console.log('Device IDs from room:', deviceIds);
|
||||||
|
|
||||||
// Filter devices for this room
|
// Filter devices for this room
|
||||||
const roomDevices = room.devices
|
const roomDevices = deviceIds
|
||||||
.map(deviceId => deviceMap[deviceId])
|
.map(deviceId => deviceMap[deviceId])
|
||||||
.filter(device => device != null);
|
.filter(device => device != null);
|
||||||
|
|
||||||
|
|||||||
@@ -256,7 +256,10 @@
|
|||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculateRoomStats(deviceIds, deviceMap) {
|
function calculateRoomStats(roomDevices, deviceMap) {
|
||||||
|
// Extract device IDs from room devices (they are objects now)
|
||||||
|
const deviceIds = roomDevices.map(d => d.device_id || d);
|
||||||
|
|
||||||
// Count device types
|
// Count device types
|
||||||
let lights = 0;
|
let lights = 0;
|
||||||
let thermostats = 0;
|
let thermostats = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user