This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to know where to send an OnOff request?

I'm working on a switch device using nRF5 SDK for Thread and Zigbee version 4.1.0 on an nRF52840 on a PCA10056.

I can get my device to join a network, and can see that the coordinator discovers all clusters and endpoints, and that it binds to the OnOff cluster as expected. zb_zdo_find_bind_src() returns true as expected. The remaining question is how I can know from code which endpoint to send the request to, in the following snippet:

    zb_uint16_t addr = 0;
    ZB_ZCL_ON_OFF_SEND_REQ(bufid,
                           addr,
                           ZB_APS_ADDR_MODE_16_ENDP_PRESENT,
                           1,
                           LIGHT_SWITCH_ENDPOINT,
                           ZB_AF_HA_PROFILE_ID,
                           ZB_ZCL_DISABLE_DEFAULT_RESPONSE,
                           cmd_id,
                           NULL);

In the light_switch example (which this is based on) the destination is found by having the light switch discover the bulb, and then save its address and endpoint, but I'm struggling a bit to see how such solution would scale. It seems more reasonable that binding happens from the coordinator, which presumably can give the user an overview over all devices in the network, and then allow binding the devices that makes sense. However, as far as I can see, for this to work, the switch device must then be able to read the local binding table to know which device it should send its messages to. How can I do this, or in what other way can I get the desired functionality?

Related