Xiaomi devices: check if exsist. #116

This commit is contained in:
Koenkk
2018-06-14 18:19:54 +02:00
parent 85e86dbdc2
commit d86aa10875
+9 -6
View File
@@ -74,12 +74,15 @@ class Zigbee {
// to query info from devices (which would fail because they go tosleep).
// Xiaomi lumi.plug has manufId === 4447 and can be in the sleep mode too
const devices = this.getAllClients();
devices.forEach((device) => {
if ((device.manufId === 4151) || (device.manufId === 4447)) {
this.shepherd.find(device.ieeeAddr, 1).getDevice().update({
status: 'online',
joinTime: Math.floor(Date.now() / 1000),
});
devices.forEach((d) => {
if ((d.manufId === 4151) || (d.manufId === 4447)) {
const device = this.shepherd.find(d.ieeeAddr, 1);
if (device) {
device.getDevice().update({
status: 'online',
joinTime: Math.floor(Date.now() / 1000),
});
}
}
});