Zigbee `SetOption116 1` to disable auto-query of light devices (avoids network storms with large groups) (#9847)

Co-authored-by: Stephan Hadinger <stephan.hadinger@gmail.com>
This commit is contained in:
s-hadinger 2020-11-14 11:15:41 +01:00 committed by GitHub
parent fae30b2912
commit dd8bb39a02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 18 deletions

View File

@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
- Support for AS608 optical and R503 capacitive fingerprint sensor
- Command ``SetOption115 1`` to enable ESP32 MiBle
- Zigbee command ``ZbLeave`` to unpair a device
- Zigbee ``SetOption116 1`` to disable auto-query of light devices (avoids network storms with large groups)
### Changed
- Core library from v2.7.4.5 to v2.7.4.7

View File

@ -141,7 +141,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
struct { // SetOption114 .. SetOption145
uint32_t mqtt_switches : 1; // bit 0 (v9.0.0.3) - SetOption114 - Detach Switches from relays and enable MQTT action state for all the SwitchModes
uint32_t mi32_enable : 1; // bit 1 (v9.1.0.1) - SetOption115 - Enable ESP32 MI32 BLE
uint32_t spare02 : 1; // bit 2
uint32_t zb_disable_autoquery : 1; // bit 2 (v9.1.0.1) - SetOption116 - Disable auto-query of lights and devices
uint32_t spare03 : 1; // bit 3
uint32_t spare04 : 1; // bit 4
uint32_t spare05 : 1; // bit 5

View File

@ -26,8 +26,6 @@
#error "You must select one of: #define USE_ZIGBEE_ZNP or #define USE_ZIGBEE_EZSP"
#endif
// #define USE_ZIGBEE_NO_READ_ATTRIBUTES // disable automatic READ ATTRIBUTES generated by Z2T - for debugging only
#define OCCUPANCY "Occupancy" // global define for Aqara
#define ZIGBEE_EZSP_RESET_LED 4 // Led<x> number to drive the EZSP Reset pin

View File

@ -1538,13 +1538,14 @@ void ZCLFrame::parseResponse(void) {
// Parse non-normalized attributes
void ZCLFrame::parseClusterSpecificCommand(Z_attribute_list& attr_list) {
convertClusterSpecific(attr_list, _cluster_id, _cmd_id, _frame_control.b.direction, _srcaddr, _srcendpoint, _payload);
#ifndef USE_ZIGBEE_NO_READ_ATTRIBUTES // read attributes unless disabled
if (!_frame_control.b.direction) { // only handle server->client (i.e. device->coordinator)
if (_wasbroadcast) { // only update for broadcast messages since we don't see unicast from device to device and we wouldn't know the target
sendHueUpdate(BAD_SHORTADDR, _groupaddr, _cluster_id);
if (!Settings.flag5.zb_disable_autoquery) {
// read attributes unless disabled
if (!_frame_control.b.direction) { // only handle server->client (i.e. device->coordinator)
if (_wasbroadcast) { // only update for broadcast messages since we don't see unicast from device to device and we wouldn't know the target
sendHueUpdate(BAD_SHORTADDR, _groupaddr, _cluster_id);
}
}
}
#endif
}
// ======================================================================

View File

@ -868,9 +868,7 @@ static const Zigbee_Instruction zb_prog[] PROGMEM = {
ZI_LOG(LOG_LEVEL_INFO, kZigbeeStarted)
ZI_CALL(&Z_State_Ready, 1) // Now accept incoming messages
ZI_CALL(&Z_Load_Devices, 0)
#ifndef USE_ZIGBEE_NO_READ_ATTRIBUTES
ZI_CALL(&Z_Query_Bulbs, 0)
#endif
ZI_LABEL(ZIGBEE_LABEL_MAIN_LOOP)
ZI_WAIT_FOREVER()

View File

@ -1885,11 +1885,13 @@ void Z_Query_Bulb(uint16_t shortaddr, uint32_t &wait_ms) {
// Send messages to query the state of each Hue emulated light
//
int32_t Z_Query_Bulbs(uint8_t value) {
// Scan all devices and send deferred requests to know the state of bulbs
uint32_t wait_ms = 1000; // start with 1.0 s delay
for (uint32_t i = 0; i < zigbee_devices.devicesSize(); i++) {
const Z_Device &device = zigbee_devices.devicesAt(i);
Z_Query_Bulb(device.shortaddr, wait_ms);
if (!Settings.flag5.zb_disable_autoquery) {
// Scan all devices and send deferred requests to know the state of bulbs
uint32_t wait_ms = 1000; // start with 1.0 s delay
for (uint32_t i = 0; i < zigbee_devices.devicesSize(); i++) {
const Z_Device &device = zigbee_devices.devicesAt(i);
Z_Query_Bulb(device.shortaddr, wait_ms);
}
}
return 0; // continue
}

View File

@ -210,9 +210,10 @@ void zigbeeZCLSendStr(uint16_t shortaddr, uint16_t groupaddr, uint8_t endpoint,
}));
// now set the timer, if any, to read back the state later
if (clusterSpecific) {
#ifndef USE_ZIGBEE_NO_READ_ATTRIBUTES // read back attribute value unless it is disabled
sendHueUpdate(shortaddr, groupaddr, cluster, endpoint);
#endif
if (!Settings.flag5.zb_disable_autoquery) {
// read back attribute value unless it is disabled
sendHueUpdate(shortaddr, groupaddr, cluster, endpoint);
}
}
}