mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2024-11-17 02:48:31 -07:00
Implement availability blacklist. #775
This commit is contained in:
parent
054892641b
commit
5828ee9989
@ -64,4 +64,7 @@ advanced:
|
||||
# Availability timeout in seconds, disabled by default (0).
|
||||
# When enabled, devices will be checked if they are still online.
|
||||
availability_timeout: 0,
|
||||
# Blacklist devices from being checked for availability
|
||||
availability_blacklist:
|
||||
- DEVICE_FRIENDLY_NAME
|
||||
```
|
||||
|
@ -22,9 +22,18 @@ class Availability {
|
||||
this.timers = {};
|
||||
this.pending = [];
|
||||
this.state = {};
|
||||
|
||||
// Initialize blacklist
|
||||
this.blacklist = settings.get().advanced.availability_blacklist.map((e) => {
|
||||
return settings.getIeeeAddrByFriendlyName(e) || e;
|
||||
});
|
||||
}
|
||||
|
||||
isPingable(device) {
|
||||
if (this.blacklist.includes(device.ieeeAddr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pingableDevices.find((d) => d.zigbeeModel.includes(device.modelId))) {
|
||||
return true;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ const defaults = {
|
||||
|
||||
// Availability timeout in seconds, disabled by default.
|
||||
availability_timeout: 0,
|
||||
availability_blacklist: [],
|
||||
|
||||
/**
|
||||
* Home Assistant requires ALL attributes to be present in ALL MQTT messages send by the device.
|
||||
|
Loading…
Reference in New Issue
Block a user