Default handler doesn't relay set color command

Hi,

I have an nrf52833-dk and adapted the light_bulb example in order to handle two endpoints. The second endpoint is a copy from the first and the same as in the light_bulb example. When I send a level control command everything works as expected and the default handler relays the information to the zcl_device_cb function. However with the color command this does not happen. For debugging purposes I temporarily created a custom endpoint handler and looked at the command that is received by the device: 

This is the command that is not relayed to the zcl_device_cb function by the default handler. Is this standard behaviour?

  • Hi,

    It looks like you are doing it correct based on the code you have shared here. The handler should work for both endpoints when they are both initialized.

    Can you share your project so I can reproduce the problem on my side?

    Best regards,
    Marte

  • Here is the example project. It creates two endpoints with the numbers 1 and 2. The "move to color" command is only relayed to the second endpoint in this example. The initialisation of the color control capabilities are found on line 761-777 in main.c. I am running this example with the nRF52833-DK.

    light_bulb_2_endpoints.zip

  • Hi,

    Thank you for sharing the project.

    I did some testing and for Level Control, zcl_device_cb is ony called when sending commands with On/Off. So you must send "Step (with On/Off)"  (command ID 0x06) instead of the regular "Step" (command ID 0x02) command. 

    As for Color Control, the command and zcl_device_cb worked as expected for both endpoints. I used Zigbee shell to test it and sent the Move to Color command with the following:

    zcl cmd 0xff10 1 0x0300 0x07 -l 0000aaaa0200

    This is what the payload of the packet looked like:

    As you can see from the log, zcl_device_cb was called for both endpoints:

    If the payload of the command was incorrect or the color values were outside the valid range, it did not enter zcl_device_cb. This might be what the issue is in your case, since I did not make any changes to your code.
    If you get a sniffer log, you should be able to see if the payload is correct or not. If it is incorrect, the device will send a Default Response packet with the status field showing the problem, similar to this:

    Best regards,
    Marte

  • Thanks to your help I was able to debug it further. When I send a single "move to color" command at either endpoint, everything works as expected. So I have the same behaviour as you. However if I send two commands in a very short amount of time, then only the second command will be relayed to zcl_device_cb. Important note: the color for the first endpoint is different from the command before.

    The commands that are being sent:

    The first and the second "move to color" command in detail:

    The first and second response:

    Moreover I did implement a test handler for both endpoints with:

    ZB_AF_SET_ENDPOINT_HANDLER(DIMMABLE_LIGHT_ENDPOINT, test_handler);
    ZB_AF_SET_ENDPOINT_HANDLER(DIMMABLE_LIGHT_ENDPOINT_2, test_handler);

    and 

    zb_uint8_t test_handler(zb_uint8_t param) {
        LOG_INF("test handler reached");
        zb_bufid_t zcl_cmd_buf = param;
        volatile zb_zcl_parsed_hdr_t *cmd_info = ZB_BUF_GET_PARAM(zcl_cmd_buf, zb_zcl_parsed_hdr_t);
        LOG_INF("destination endpoint: %d", cmd_info->addr_data.common_data.dst_endpoint);
        return 0;
    };

    Now I can see that when I send two endpoints in a short sequence my test_handler gets called two times, one for each endpoint. However, only the second command also gets relayed to the default handler as well. The package that does not get relayed can be seen in the original post.

  • Hi,

    I have asked the development team about this, and I will update you when I hear back from them.

    Best regards,
    Marte

Related