diff --git a/CHANGELOG.md b/CHANGELOG.md index 7562fc9a9..179921dd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/tasmota/settings.h b/tasmota/settings.h index deaa7fa39..76e499281 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -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 diff --git a/tasmota/xdrv_23_zigbee_0_constants.ino b/tasmota/xdrv_23_zigbee_0_constants.ino index 857279f48..50c9e4eee 100644 --- a/tasmota/xdrv_23_zigbee_0_constants.ino +++ b/tasmota/xdrv_23_zigbee_0_constants.ino @@ -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 number to drive the EZSP Reset pin diff --git a/tasmota/xdrv_23_zigbee_5_converters.ino b/tasmota/xdrv_23_zigbee_5_converters.ino index 7b2cb29b2..5b1f5f0d5 100644 --- a/tasmota/xdrv_23_zigbee_5_converters.ino +++ b/tasmota/xdrv_23_zigbee_5_converters.ino @@ -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 } // ====================================================================== diff --git a/tasmota/xdrv_23_zigbee_7_statemachine.ino b/tasmota/xdrv_23_zigbee_7_statemachine.ino index 65da03d24..1cbb29d5d 100644 --- a/tasmota/xdrv_23_zigbee_7_statemachine.ino +++ b/tasmota/xdrv_23_zigbee_7_statemachine.ino @@ -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() diff --git a/tasmota/xdrv_23_zigbee_8_parsers.ino b/tasmota/xdrv_23_zigbee_8_parsers.ino index 26bbe45e8..8e3bffc6f 100644 --- a/tasmota/xdrv_23_zigbee_8_parsers.ino +++ b/tasmota/xdrv_23_zigbee_8_parsers.ino @@ -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 } diff --git a/tasmota/xdrv_23_zigbee_A_impl.ino b/tasmota/xdrv_23_zigbee_A_impl.ino index 7acd3e4a1..bf8fa3730 100644 --- a/tasmota/xdrv_23_zigbee_A_impl.ino +++ b/tasmota/xdrv_23_zigbee_A_impl.ino @@ -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); + } } }