Hello, I'm using Zigbee SDK 4.0.0 with Segger Embedded Studio 4.30 and custom pca10059-compatible debug board.
I ran into difficulties when trying to subscribe to attributes when the device has 4 identical endpoints (endpoint numbers are 10, 11, 12 and 13).
Each endpoint provides on/off and level control clusters with two attributes that I can subscribe to:
ZB_HA_DIMMABLE_LIGHT_REPORT_ATTR_COUNT is defined as 2, so each endpoint contains array of two zb_zcl_reporting_info_t structs.
At start ZB_AF_REGISTER_DEVICE_CTX macro registers all endpoints and fills fields of zb_zcl_reporting_info_t structs.
zb_zcl_reporting_info_t of first 3 endpoints (10, 11 and 12) receive 0x11 at flags field, but last endpoint (13) receive 0x13 at flags field.
After the device starts and connects to the network I try to bind and subscribe to attributes from the cli tool. Subscribe command fails for endpoints 10, 11 and 12 but succeeds for the last endpoint 13. Fail response looks like this:
At this time I do not see any meaningful information in the log that could help.
For endpoint 13 I'm able to subscribe and receive attribute change reports.
Exactly the same behavior with default unmodified example ble_zigbee_dynamic_color_light_bulb_thingy from Zigbee SDK 4.0.0: I'm able to subscribe to the last endpoint's attributes, but subscribe command fails for first and second endpoint.
Then I change ZB_HA_DIMMABLE_LIGHT_REPORT_ATTR_COUNT definition in my code from 2 to 4 (so each endpoint contains 4 zb_zcl_reporting_info_t structs) I'm able to subscribe to all 8 attributes (2 per endpoint) without any errors, but in this case I receive attribute change reports from the last (13) endpoint only. No reports received from endpoints 10, 11 and 12.
In this case ZB_AF_REGISTER_DEVICE_CTX fills first two (of 4 total in the array) zb_zcl_reporting_info_t structs at each endpoint, but after successful subscription to all 8 attributes (2 per endpoint) I see that for the last endpoint (13) first two zb_zcl_reporting_info_t structs are overwritten by my subscription data, but for first three endpoints (10, 11, 12) first two zb_zcl_reporting_info_t structs are remains unchanged and subscription data is written to the third and fourth position of zb_zcl_reporting_info_t array.
For some reason unknown to me, first two reporting info structures remains unchanged for first three endpoints and at subscription Zigbee stack uses next two available structures - that's why subscription fails when the only two reporting info structs are available.
But for the last endpoint this reporting info structures are overwritten at subscription (as expected by me). That's why the subscription was successful on the last endpoint when the only two reporting info structs are available.
It seems like I'm doing something wrong, but I just can't figure it out. Could you help me with this?
Update 1, sniffer logs for ble_zigbee_dynamic_color_light_bulb_thingy + cli:
Bind:
Subscribe:
Cli commands used to subscribe:
Update 2: added raw Wireshark dump: