Fix room devices and bump version
This commit is contained in:
parent
afe7dba757
commit
5454c8e16b
2 changed files with 10 additions and 5 deletions
|
|
@ -41,12 +41,17 @@ class DeviceRegistry {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (added.roomId) {
|
if (added.roomId) {
|
||||||
const room = this.deviceIdsByRoom[added.roomId] || [];
|
if (!this.deviceIdsByRoom[added.roomId]) {
|
||||||
if (!room.includes(added.roomId)) {
|
this.deviceIdsByRoom[added.roomId] = [];
|
||||||
this.deviceIdsByRoom[added.roomId] = [...room, added.roomId];
|
}
|
||||||
|
const room = this.deviceIdsByRoom[added.roomId];
|
||||||
|
if (!room.includes(added.id)) {
|
||||||
|
this.deviceIdsByRoom[added.roomId] = [...room, added.id];
|
||||||
}
|
}
|
||||||
logger.verbose(
|
logger.verbose(
|
||||||
`Added to room #${added.roomId}: ${JSON.stringify(this.deviceIdsByRoom[added.roomId])}`,
|
`Added device to room ${added.roomId}: ${JSON.stringify(
|
||||||
|
this.deviceIdsByRoom[added.roomId],
|
||||||
|
)}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Plejd",
|
"name": "Plejd",
|
||||||
"version": "0.7.0",
|
"version": "0.7.1",
|
||||||
"slug": "plejd",
|
"slug": "plejd",
|
||||||
"description": "Adds support for the Swedish home automation devices from Plejd.",
|
"description": "Adds support for the Swedish home automation devices from Plejd.",
|
||||||
"url": "https://github.com/icanos/hassio-plejd/",
|
"url": "https://github.com/icanos/hassio-plejd/",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue