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?

  • Hi Ole,

    Sorry for the late reply. I thought I already had cover this in my previous answers. If you have a network that includes a coordinator, a switch and several light bulbs, you can send from the coordinator and 'add_group' command to the light bulbs you want to assign the same group ID to, and then from the coordinator send a 'bind on' command to the switch with the group ID as the destination address. Does this answer your question?

  • Unfortunately, as far as I can see this still doesn't answer the question.

    Creating a group from my coordinator works fine (although I see no way to do so through the Nordic coordinator's CLI interface, but that doesn't matter as my end application won't use that), and binding a switch to the group is also fine.

    The missing piece is how to determine which address and endpoint to send the request to.

    As far as I can see, I receive no callback to my code when a bind happens, and I'm unable to see any way to locally read out the binding table (although I can do it from the coordinator, using 'zdo mgmt_bind'). I hence don't know what to use for addr and endpoint in the following snippet:

        zb_uint16_t addr = ?;
        zb_uint8_t endpoint = ?;
        ZB_ZCL_ON_OFF_SEND_REQ(bufid,
                               addr,
                               ZB_APS_ADDR_MODE_16_ENDP_PRESENT,
                               endpoint,
                               LIGHT_SWITCH_ENDPOINT,
                               ZB_AF_HA_PROFILE_ID,
                               ZB_ZCL_DISABLE_DEFAULT_RESPONSE,
                               cmd_id,
                               NULL);

Related