Prevent battery devices to be checked for availability. https://github.com/Koenkk/zigbee2mqtt/issues/775

This commit is contained in:
Koen Kanters
2019-01-01 22:15:05 +01:00
parent 57aefe477d
commit 74cdde23b9
+6 -3
View File
@@ -25,9 +25,12 @@ class DeviceAvailabilityHandler {
this.queue.autostart = true;
}
isPingable(device) {
return device.type === 'Router' && (device.powerSource && device.powerSource !== 'Battery');
}
getAllPingableDevices() {
return this.zigbee.getAllClients()
.filter((d) => d.type === 'Router' && (d.powerSource && d.powerSource !== 'Battery'));
return this.zigbee.getAllClients().filter((d) => this.isPingable(d));
}
onMQTTConnected() {
@@ -102,7 +105,7 @@ class DeviceAvailabilityHandler {
onZigbeeMessage(message, device, mappedDevice) {
// When a zigbee message from a device is received we know the device is still alive.
// => reset the timer.
if (device) {
if (device && this.isPingable(this.zigbee.getDevice(device.ieeeAddr))) {
this.setTimer(device.ieeeAddr);
}
}