feat(Zigbee): Recall bounded devices after reboot + IEEE address option for commands by P-R-O-C-H-Y · Pull Request #10676 · espressif/arduino-esp32 (original) (raw)

Hi @P-R-O-C-H-Y, I think there may be a subtle issue with this.

In handling ESP_ZB_ZDO_SIGNAL_LEAVE, there are apparently 2 leave types: ZB_NWK_LEAVE_TYPE_REJOIN and ZB_NWK_LEAVE_TYPE_RESET. However it's ignored and it always calls Zigbee.factoryReset().

My ESP32C6 seemed to randomly factory reset itself, so I started looking into the code. Months ago, in packet captures, I had noticed an issue where IKEA bulbs (Silicon Designs stack, I think) were telling my Lutron Zigbee remotes (Atmel?) to "leave", which dropped them off the network. I think something similar may have happened here.

So, perhaps we should only be resetting if ZB_NWK_LEAVE_TYPE_RESET is set? And/or if it's from the coordinator?

[26523678][V][ZigbeeTempSensor.cpp:112] setHumidity(): Updating humidity sensor value...
[26523678][D][ZigbeeTempSensor.cpp:114] setHumidity(): Setting humidity to 2090
[26523679][V][ZigbeeTempSensor.cpp:71] setTemperature(): Updating temperature sensor value...
[26523679][D][ZigbeeTempSensor.cpp:73] setTemperature(): Setting temperature to 2430
[26524179][I][o2.ino:140] zigbee_reading_handler(): Sent average of readings of oxygen=20.9%, temperature=24.3 C (60 total readings)
[26524677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.3 C (2518 us)
[26525677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.4 C (2416 us)
[26526677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.3 C (2485 us)
[26526711][I][ZigbeeCore.cpp:225] esp_zb_app_signal_handler(): Device started up in non factory-reset mode
[26526711][I][ZigbeeCore.cpp:238] esp_zb_app_signal_handler(): Device rebooted
[26526712][D][ZigbeeCore.cpp:466] searchBindings(): Requesting binding table for address 0x81e6
[26526713][D][ZigbeeCore.cpp:406] bindingTableCb(): Binding table callback for address 0x81e6 with status 0
[26526714][D][ZigbeeCore.cpp:409] bindingTableCb(): Binding table info: total 2, index 0, count 2
[26526714][D][ZigbeeCore.cpp:419] bindingTableCb(): Binding table record: src_endp 10, dst_endp 1, cluster_id 0x0402, dst_addr_mode 3
[26526715][D][ZigbeeCore.cpp:436] bindingTableCb(): Device bound to EP 10 -> device endpoint: 1, short addr: 0x0000, ieee addr: <censored>
[26526715][D][ZigbeeCore.cpp:419] bindingTableCb(): Binding table record: src_endp 10, dst_endp 1, cluster_id 0x0405, dst_addr_mode 3
[26526716][D][ZigbeeCore.cpp:436] bindingTableCb(): Device bound to EP 10 -> device endpoint: 1, short addr: 0x0000, ieee addr: <censored>
[26526717][D][ZigbeeCore.cpp:457] bindingTableCb(): Filling bounded devices finished
[26527677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.4 C (2539 us)
[26528677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.4 C (2408 us)
[26529677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.3 C (2336 us)
[26530677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.2 C (2474 us)
[26531677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.4 C (2433 us)
[26532677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.3 C (2415 us)
[26533677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.3 C (2457 us)
[26534677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.4 C (2414 us)
[26535677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.3 C (2399 us)
[26536677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.3 C (2451 us)
[26537677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.4 C (2413 us)
[26538677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.5 C (2408 us)
[26539677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.3 C (2449 us)
[26540677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.3 C (2526 us)
[26541677][D][o2.ino:57] sensor_read(): oxygen=20.9% temperature=24.3 C (2402 us)
[26542032][V][ZigbeeCore.cpp:344] factoryReset(): Factory resetting Zigbee stack, device will reboot
ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0xc (SW_CPU),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x4001975a
SPIWP:0xee
mode:DIO, clock div:2
load:0x40875720,len:0x1228
load:0x4086c110,len:0xd9c
load:0x4086e610,len:0x2f74
entry 0x4086c110