espressif / esp-zigbee-sdk

Espressif Zigbee SDK
Apache License 2.0
156 stars 26 forks source link

End device binding table (TZ-1129) #426

Open akira215 opened 2 weeks ago

akira215 commented 2 weeks ago

Question

I'm working on zigbee end devices and I cannot figure out how to access the device binding table: I'm able to send esp_zb_zdo_binding_table_req command that return table but I understood that it is the reading of remote device (coordinator), am I correct ? Moreover, the returned structures linked by the next pointer are not located at the same memory address than the one returned by continuously requesting the next record using index.

I was guessing that the end device shall have it's own binding table, ideally using NVS. Is it the case in the sdk implementation ? If yes how could I retrieve this table ?

Additionally, I try to get the signal from the stack when the coordinator send a binding request to the end device (on end device side). I saw the request using a sniffer, I see some traffic on the esp_zb_aps_data_indication_handler, but the esp_zb_app_signal_handler don't trigger anything (i was guessing ESP_ZB_BDB_SIGNAL_FINDING_AND_BINDING_INITIATOR_FINISHED or ESP_ZB_BDB_SIGNAL_FINDING_AND_BINDING_TARGET_FINISHED). How could i set up a call back to intercept the binding request from coordinator on end device side ?

Thanks ahead

Additional context.

No response

lpy4105 commented 1 week ago

Hi @akira215

I'm able to send esp_zb_zdo_binding_table_req command that return table but I understood that it is the reading of remote device (coordinator), am I correct ?

It's partially true. ZDO commands are sent through the network, you can send the request to the local device if you populate the correct address.

I was guessing that the end device shall have it's own binding table, ideally using NVS. Is it the case in the sdk implementation ? If yes how could I retrieve this table ?

The SDK implements binding table for end device and stores it in NVS. You can send esp_zb_zdo_binding_table_req to local device to retrieve the binding table.

Additionally, I try to get the signal from the stack when the coordinator send a binding request to the end device (on end device side).

Bindings are processed by the APS layer of the stack, users are not expected to deal with it themselves. Any special use cases?

akira215 commented 1 day ago

Hi sorry for the late reply, was abroad.

The thing is that the esp_zb_zdo_binding_table_req return every bindings it cannot be filtered just for the end device itself.

I understood that bindings are low level dealed by APS, my app would work without checking the device table, but i was wondering if i can check the table stored in the device, to be able to clean it if required and deal with custom bindings attributes.