#ZIgbee device rejoins automatically after being removed

1 messages ยท Page 1 of 1 (latest)

vague herald
#

I'm using the ESP32-C6 and the EXPRESSIF Arduino library to develop end points. It's working pretty well but I noticed that if I join a device to the controller Home Assistant ZHA and let it run for a few minutes, then go to the ZHA device page and remove it, it automatically rejoins even if I haven't enabled add device!!??. Another user @grand shell in the EXPRESSIF Arduino core channel confirmed this but also noted that he waited for a while after the initial join that a removed device would not automatically rejoin. Is this defined functionality or a bug?

nimble gust
#

I've observed this before. I'm just speculating, but I think when you Remove a device, what happens is that the data about the device at the coordinator end is removed, but the device doesn't know it's been removed and still has the info needed to communicate with the network. Then if it happens to send something to the coordinator after it was Removed, the coordinator will recreate a device since the device knows the correct info.

#

To avoid this, you can depower the device first (unplug or remove battery), then Remove it from the ZigBee network.

grand shell
#

Indeed (for ESP) when you remove a device, the coordinator send a leave message to the device. When this arrives to the device, we call a factory reset that should erase all the network informations and start as factory new device. So this should not happen but maybe there is some part which is not erased properly. We need to investigate this ๐Ÿ™‚

vague herald
#

The coordinator should record in it's state data that an EP was deleted and the next time that device wakes up and sends a message it would be sent the leave message.

vague herald
#

The sleepy ep upon receipt of a leave message should acknowledged the message ,the coordinator upon receipt of the ACK would forget the EP, the EP perform a factory reset and enter deep sleep without any wake setting. Then it will only wake up if reset is pressed or it's power cycled. Then it will look to join a coordinator in add device state and if one is not found after some period of time go back to deep sleep until manually awakened again. If the EP is forced to factory reset it by press of the boot button should look for a coordinator in add new device mode to join or if the EP is still enrolled on the coordinator rejoin it. There must be something in the ZIgbee spec for these scenarios but since I've never read it the above is just my guess on how they would work. There's likely other state transitions and scenarios to be handled. I guess I should get it and try to figure out how EP code should be designed with the Arduino API. I hope that EXPRESSIF creates how to docs for the Arduino ZIgbee API because it's not obvious how to code a ZIgbee compliant EP using the API. The examples are rudimentary and don't explain the states and transitions. You have to read between the lines to TRY deduce that by trial and error if you're not a ZIgbee expert. I appreciate the effort of EXPRESSIF to bring ZIgbee to the unwashed hacks like me who just want to roll their own using nice devices like C6 and H2 on Arduino.

vague herald
#

Ooof the ZIgbee specification is 565 pages ๐Ÿ˜ญ

grand shell
#

Yes and its only the Zigbee specification, you have also clusters specification ๐Ÿ˜„ there is a lot to read