JohanBendz / tech.sonoff

MIT License
3 stars 5 forks source link

TH01/SNZB-02/SNZB-02D and ZBMINI-L overflowing zigbee network with unnecessary batteryPercentageRemaining and onOff messages #17

Open Boechie opened 1 month ago

Boechie commented 1 month ago

I use multiple TH01/SNZB-02/SNZB-02D (temperature and humidity sensor) and ZBMINI-L (relay) devices. About 50% of the TH01/SNZB-02/SNZB-02D devices report their remaining battery% every few seconds (every 6 secs on average per device). All ZBMINI-L devices report their onOff state exactly every 10 seconds without any change to this onOff state. To my believe this causes problems on the zigbee network and moreover those messages/reports are unnecessary, i.e. they don't add any value.

After some research to the cause of this, I found this:

ZBMINI-L The attributeReportingConfig for all of my ZBMINI-L devices states minInterval: 0, maxInterval: 10, which confirms the behaviour. I think this is the factory default setting as I never hooked these devices to any other system/hub and the Sonoff Zigbee driver never writes any attributeReportingConfig for these devices. Proposed solution would be to configure attributeReporting to more optimal values at least once for every ZBMINI-L device.

TH01/SNZB-02/SNZB-02D In onNodeInit and onSettings the driver writes a attributeReportingConfig for batteryPercentageRemaining with these values: minInterval: 65535, maxInterval: 0, minChange: 0. According to ZCL Specification 2.5.7.1.5, 2.5.7.1.6 and 2.5.7.1.7 this causes the attributeReportingConfig to revert to its factory default config. Probably this causes the high frequency reports. Contrarily, in onEndDeviceAnnounce, attributeReportingConfig for batteryPercentageRemaining is written with these values: minInterval: 3600, maxInterval: 65535, minChange: 2. Proposed solution would be to configure attributeReporting to more optimal values at least once for every TH01/SNZB-02/SNZB-02D device.