mirror of https://github.com/arendst/Tasmota.git
Zigbee don't report Battery for IKEA devices
This commit is contained in:
parent
37d74810ba
commit
4e61d99237
|
@ -2004,4 +2004,19 @@ void Z_Data::toAttributes(Z_attribute_list & attr_list, Z_Data_Type type) const
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check if this device needs Battery reporting
|
||||
// This is usefule for IKEA device that tend to drain battery quickly when Battery reporting is set
|
||||
//
|
||||
bool Z_BatteryReportingDeviceSpecific(uint16_t shortaddr) {
|
||||
const Z_Device & device = zigbee_devices.findShortAddr(shortaddr);
|
||||
if (device.manufacturerId) {
|
||||
String manuf_c(device.manufacturerId);
|
||||
if (manuf_c.startsWith(F("IKEA"))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // USE_ZIGBEE
|
||||
|
|
|
@ -614,6 +614,7 @@ void Z_AutoBindDefer(uint16_t shortaddr, uint8_t endpoint, const SBuffer &buf,
|
|||
for (uint32_t i=0; i<ARRAY_SIZE(Z_bindings); i++) {
|
||||
if (bitRead(cluster_map, i)) {
|
||||
uint16_t cluster = CxToCluster(pgm_read_byte(&Z_bindings[i]));
|
||||
if ((cluster == 0x0001) && (!Z_BatteryReportingDeviceSpecific(shortaddr))) { continue; }
|
||||
zigbee_devices.queueTimer(shortaddr, 0 /* groupaddr */, 2000, cluster, endpoint, Z_CAT_BIND, 0 /* value */, &Z_AutoBind);
|
||||
}
|
||||
}
|
||||
|
@ -622,6 +623,7 @@ void Z_AutoBindDefer(uint16_t shortaddr, uint8_t endpoint, const SBuffer &buf,
|
|||
for (uint32_t i=0; i<ARRAY_SIZE(Z_bindings); i++) {
|
||||
if (bitRead(cluster_in_map, i)) {
|
||||
uint16_t cluster = CxToCluster(pgm_read_byte(&Z_bindings[i]));
|
||||
if ((cluster == 0x0001) && (!Z_BatteryReportingDeviceSpecific(shortaddr))) { continue; }
|
||||
zigbee_devices.queueTimer(shortaddr, 0 /* groupaddr */, 2000, cluster, endpoint, Z_CAT_CONFIG_ATTR, 0 /* value */, &Z_AutoConfigReportingForCluster);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue