espressif / esp-zigbee-sdk

Espressif Zigbee SDK
Apache License 2.0
164 stars 28 forks source link

Unable to force specific network (pan ID, extended pan ID). (TZ-1269) #472

Open Fienberber opened 2 days ago

Fienberber commented 2 days ago

Question

Hellpo, I'm facing a behavior which was partially addressed in some issues. I try to make a Zigbee Gateway using the esp_zigbee_gateway example, and I need to force the the device on a specific zigbee network. I'd like to switch networks.

For this I use : esp_zb_set_extended_pan_id, esp_zb_set_pan_id which don't work each time. I also use esp_zb_set_primary_network_channel_set and I also set the network keys, which seem to work just fine.

I'm able to set the pan ID but not reliably. It work only once, after one forced network switch I have to restart the chip.

I'm probably missing something. I feel like there is one thing I didn't understand otherwise it would work 100% of the time.

I tried to set the pan ID (extended and normal) between esp_zb_init and esp_zb_start during the startup sequence without success, this won't work at all. It would be nice if I can switch network during the normal operation of the device.

If you need more informations I'll share it. Thanks in advance for your help.

Additional context.

No response

xieqinan commented 1 day ago

@Fienberber ,

it would be nice if I can switch network during the normal operation of the device.

Zigbee does not support switching networks once the network has been formed. Therefore, esp_zb_set_extended_pan_id() and esp_zb_set_pan_id() only take effect when the device is in a factory-new state.

Fienberber commented 1 day ago

@xieqinan thank you for your quick reply.

It seem quite understandable that a factory-new state is required. That is what I'm doing but I unable to do it multiple time in a row.

is the use of esp_zb_bdb_reset_via_local_action to trigger a factory reset appropriate ? Do I need to do something else to keep the Zigbee stack in the same state ?

xieqinan commented 14 hours ago

Hi @Fienberber ,

The stack only allows the application to set the PAN ID once during runtime. Could you please provide more details about the application background? There might be a better solution for your needs.