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

"zcl_device_cb" of "light-control" filter not OnOff data

Hi Nordic team,
I'm working with nRF52840 PCA10056, base on Thread_Zigbee_v4.1.0, and light_control example.
I modifed, try to add temp_measurement ZCL in all light_bulb / light_switch to receive/trans temperature data - to exact addr.
but "light-bulb" isn't jump to "zcl_device_cb" (just with Temp cmd, OnOff cmd still ok). Maybe declare wrong temp ZCL, or missing anything.

This is my situation:


And below figure, I think "light_switch" have trans out, but not sure "light_bulb" can get:

And this code on "light-switch":

I also saw "pressure_cluster", "multi_sensor" but not clear, i dont known how/where/when use "zb_zcl_add_cluster_handlers".
I read "">infocenter.nordicsemi.com/index.jsp dont have progression.
Please guide me the way to adding 1 cluster (Temp cluster...).

If you need more infor, please note me.

Thank you.
VDM

Parents
  • Hi,

    In ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ you are using ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID as cmd_id. cmd_id is the command identifier, and must be the ID of a command, such as ZB_ZCL_CMD_ON_OFF_OFF_ID. However, ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID is not a command, but the ID of the attribute MeasuredValue. You can therefore not get the temperature measurement using this. If you read about the temperature measurement cluster in the Zigbee Cluster Library specification (chapter 4.4 in revision 6), you can see that the cluster does not have any commands, only attributes. You can get MeasuredValue by either using the read attributes command or report attributes command. Since you want to get the temperature measurement after a button press and not receive it periodically, read attributes command would be the best choice.

    You can read detailed information about the read attributes command in the ZCL spec (chapter 2.5.1 in revision 6). There you can see when this command is generated, effect on receipts, as well as information regarding the read attribute response command. For more information about how to implement this in our SDK, you can check out Read attributes request and response sending and parsing where you can find macros and more detailed descriptions. In order to receive MeasuredValue from the light bulb, the light switch will have to send a read attributes request commend, which can be formed and sent as below:

    ZB_ZCL_GENERAL_INIT_READ_ATTR_REQ(zcl_cmd_buf, cmd_ptr, ZB_ZCL_ENABLE_DEFAULT_RESPONSE);
    ZB_ZCL_GENERAL_ADD_ID_READ_ATTR_REQ(cmd_ptr, ZB_ZCL_ATTR_BINARY_INPUT_PRESENT_VALUE_ID);
    ZB_ZCL_GENERAL_SEND_READ_ATTR_REQ(zcl_cmd_buf, cmd_ptr, DUT_ADDR, DUT_ADDR_MODE, DUT_ENDPOINT,
                                     TH_ENDPOINT, ZB_AF_HA_PROFILE_ID,
                                     ZB_ZCL_CLUSTER_ID_BINARY_INPUT, NULL);

    When the light bulb receives the read attributes request it will generate a read attributes response as a response to this. The read attributes response can be parsed as:

    ZB_ZCL_GENERAL_GET_NEXT_READ_ATTR_RES(buf, read_attr_resp);

    The documentation for all of these macros can be found in the link I added above. If you want to see an example where this is used, you can check out the function readattr_send() on line 324 in /components/zigbee/cli/zigbee_cli_cmd_attr.c.

    Best regards,

    Marte

Reply
  • Hi,

    In ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ you are using ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID as cmd_id. cmd_id is the command identifier, and must be the ID of a command, such as ZB_ZCL_CMD_ON_OFF_OFF_ID. However, ZB_ZCL_ATTR_TEMP_MEASUREMENT_VALUE_ID is not a command, but the ID of the attribute MeasuredValue. You can therefore not get the temperature measurement using this. If you read about the temperature measurement cluster in the Zigbee Cluster Library specification (chapter 4.4 in revision 6), you can see that the cluster does not have any commands, only attributes. You can get MeasuredValue by either using the read attributes command or report attributes command. Since you want to get the temperature measurement after a button press and not receive it periodically, read attributes command would be the best choice.

    You can read detailed information about the read attributes command in the ZCL spec (chapter 2.5.1 in revision 6). There you can see when this command is generated, effect on receipts, as well as information regarding the read attribute response command. For more information about how to implement this in our SDK, you can check out Read attributes request and response sending and parsing where you can find macros and more detailed descriptions. In order to receive MeasuredValue from the light bulb, the light switch will have to send a read attributes request commend, which can be formed and sent as below:

    ZB_ZCL_GENERAL_INIT_READ_ATTR_REQ(zcl_cmd_buf, cmd_ptr, ZB_ZCL_ENABLE_DEFAULT_RESPONSE);
    ZB_ZCL_GENERAL_ADD_ID_READ_ATTR_REQ(cmd_ptr, ZB_ZCL_ATTR_BINARY_INPUT_PRESENT_VALUE_ID);
    ZB_ZCL_GENERAL_SEND_READ_ATTR_REQ(zcl_cmd_buf, cmd_ptr, DUT_ADDR, DUT_ADDR_MODE, DUT_ENDPOINT,
                                     TH_ENDPOINT, ZB_AF_HA_PROFILE_ID,
                                     ZB_ZCL_CLUSTER_ID_BINARY_INPUT, NULL);

    When the light bulb receives the read attributes request it will generate a read attributes response as a response to this. The read attributes response can be parsed as:

    ZB_ZCL_GENERAL_GET_NEXT_READ_ATTR_RES(buf, read_attr_resp);

    The documentation for all of these macros can be found in the link I added above. If you want to see an example where this is used, you can check out the function readattr_send() on line 324 in /components/zigbee/cli/zigbee_cli_cmd_attr.c.

    Best regards,

    Marte

Children
No Data
Related