Fix setting state for created Plejd room devices
- when using includeRoomsAsLights setting
This commit is contained in:
parent
3804c63991
commit
55f0f60be9
3 changed files with 12 additions and 4 deletions
|
|
@ -332,14 +332,17 @@ class PlejdApi {
|
|||
const { roomId } = room;
|
||||
const roomAddress = this.siteDetails.roomAddress[roomId];
|
||||
|
||||
const deviceIdsByRoom = this.deviceRegistry.getDeviceIdsByRoom(roomId);
|
||||
|
||||
const dimmable = deviceIdsByRoom
|
||||
&& deviceIdsByRoom.some((deviceId) => this.deviceRegistry.getDevice(deviceId).dimmable);
|
||||
|
||||
const newDevice = {
|
||||
id: roomAddress,
|
||||
name: room.title,
|
||||
type: 'light',
|
||||
typeName: 'Room',
|
||||
dimmable: this.deviceIdsByRoom[roomId].some(
|
||||
(deviceId) => this.plejdDevices[deviceId].dimmable,
|
||||
),
|
||||
dimmable,
|
||||
};
|
||||
|
||||
this.deviceRegistry.addRoomDevice(newDevice);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue