mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-28 05:24:29 +00:00
Prevent battery devices to be checked for availability. https://github.com/Koenkk/zigbee2mqtt/issues/775
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user