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

Thermostat cluster enable issue

Hi All,

I am developing product using nRF52840 and SDK nRF5_SDK_for_Thread_and_Zigbee_v3.0.0_d310e71.

This product is basically, using the Thermostat cluster and Zigbee protocol to communicate with the Zigbee gateway.

So, I referred light_bulb example and followed steps to enable "Thermostat cluster and attributes".

I have included the respective files also but I am unable to execute the below callback function case statement,

static zb_void_t zcl_device_cb(zb_uint8_t param)
{
    zb_uint8_t                       cluster_id;
    zb_uint8_t                       attr_id;
    zb_buf_t                       * p_buffer = ZB_BUF_FROM_REF(param);
    zb_zcl_device_callback_param_t * p_device_cb_param =
                     ZB_GET_BUF_PARAM(p_buffer, zb_zcl_device_callback_param_t);

    NRF_LOG_INFO("zcl_device_cb id %hd", p_device_cb_param->device_cb_id);

    /* Set default response value. */
    p_device_cb_param->status = RET_OK;

    switch (p_device_cb_param->device_cb_id)
    {
        case ZB_ZCL_SET_ATTR_VALUE_CB_ID:
            cluster_id = p_device_cb_param->cb_param.set_attr_value_param.cluster_id;
            attr_id    = p_device_cb_param->cb_param.set_attr_value_param.attr_id;

            if (cluster_id == ZB_ZCL_CLUSTER_ID_THERMOSTAT)
            {
                uint16_t value = p_device_cb_param->cb_param.set_attr_value_param.values.data16;

                NRF_LOG_INFO("thermostat local temperature: %d", value);
                if (attr_id == ZB_ZCL_ATTR_THERMOSTAT_LOCAL_TEMPERATURE_ID)
                {
                    local_temperature_value(value);
                }
            }
            else
            {
                /* Other clusters can be processed here */
                NRF_LOG_INFO("Unhandled cluster attribute id: %d", cluster_id);
            }
        break;

        default:
            p_device_cb_param->status = RET_ERROR;
            break;
    }

    NRF_LOG_INFO("zcl_device_cb status: %hd", p_device_cb_param->status);
}

Also, I am attaching code for reference please let me know what else I forgot to enable the functions. It is urgent for me to solve this issue.

Radiator_nRF_v0.9.0.zip

And, with these attributes, for some of the commands, I need to implement custom attributes so if you share how to add custom attributes to this cluster.

Thanks in advance.

Regards,

Rohit R

Parents
  • Hi Marte,

    Okay, thanks for the feedback.

    Sorry for the inconvenience might be project not attached properly. Now I do not want to add a custom cluster or any new cluster. so let's close this here.

    I want to add manufacturer attributes now.

    Have you checked the nxp document and the section mentioned in another ticket?.

    In that section, they have explained the enabling procedure for adding manufacturer attributes to any cluster. And I want the same requirement/procedure for my product.

    I want to enable manufacturer Id and add extra attribute IDs to the thermostat cluster from (extra attribute id - 0x4000 to 0x4008) and do read/write operation on extra added attributes.

    So let me know how I can add extra manufacturer attribute ids to the thermostat cluster (cluster id - 0x0201).

    And,

     This is required if you want to get the contents of the next read attribute response frame yourself with ZB_ZCL_GENERAL_GET_NEXT_READ_ATTR_RES. Usually, sending and parsing attribute requests are handled internally by the stack. If you want to get the contents of this, you will have to implement a handler for this, such as is done with cli_agent_ep_handler_attr(). This intercepts the frames coming to your device so that you can do something with them yourself, instead of everything being done by the stack.

    - Okay, this I will check parallelly.

    But my first task is to complete adding manufacturer attribute Id to the thermostat cluster.

    So let me know the procedure for same to adding attributes.

    Note,

    I do not want to enable a custom cluster.

    Thanks and Regards

    Rohit

  • Hi Rohit,

    I have tried to add custom attributes to existing clusters, but I have not been able to yet. My initial idea was to create an extended attribute list, such as in for example the basic cluster. However, it does not seem to work. This might be because the the clusters are implemented and precompiled in the stack, so changing the clusters themselves might not be possible. I have asked our developers about this, and whether it is possible to add custom attributes to existing clusters or not, but I have not received a response yet. I will let you know when I do.

    The ZLL attributes in your picture, Global Scene Control, On Time, Off Wait Time and Start Up On Off, are already in the attribute list of the On/Off cluster. However, you must use zb_zcl_on_off_attrs_ext_t and not zb_zcl_on_off_attrs_t. This can be found in the add on file for the On/Off cluster, zb_zcl_on_off_addons.h. This is true for other clusters with extended attribute lists or add ons as well. All of these can be found in the folder external\zboss\addons\zcl.

    I am not sure what Tuya is. Is it a manufacturer specific attribute?

    Best regards,

    Marte

  • Hi Rohit,

    One thing I see is that you have

    if (cluster_id == ZB_ZCL_CLUSTER_ID_THERMOSTAT)

    ...

    else if (cluster_id == ZB_ZCL_CLUSTER_ID_THERMOSTAT)

    Here, your code will always go into the first if when the cluster is the Thermostat cluster, and will never enter the else if on line 421, since when you use if, else if, and else conditions, it will only enter the first condition that is true, and will ignore all the rest. You should instead do something like this, where both MIN_HEAT_SETPOINT_LIMIT and CURRENT_SETPOINT_CHANGE are under the if ZB_ZCL_CLUSTER_ID_THERMOSTAT:

    case ZB_ZCL_SET_ATTR_VALUE_CB_ID:
        cluster_id = p_device_cb_param->cb_param.set_attr_value_param.cluster_id;
        attr_id    = p_device_cb_param->cb_param.set_attr_value_param.attr_id;
        
        if (cluster_id == ZB_ZCL_CLUSTER_ID_THERMOSTAT)
        {
            if (attr_id == ZB_ZCL_ATTR_THERMOSTAT_MIN_HEAT_SETPOINT_LIMIT_ID)
            {
                zb_int16_t value = p_device_cb_param->cb_param.set_attr_value_param.values.data16;
                minheatingsetpoint(value);
            }
            else if (attr_id ==ZB_ZCL_ATTR_THERMOSTAT_CURRENT_SETPOINT_CHANGE_ID)
            {
                zb_int16_t value = p_device_cb_param->cb_param.set_attr_value_param.values.data16;
                current_setpoint_change_value(value);
            }
        }
        else if (cluster_id == ZB_ZCL_CLUSTER_ID_POWER_CONFIG)
        {
        ...

    The current_setpoint_change() function snippet is correct.

    Best regards,

    Marte

  • Hi Marte, 

    Sorry for this inconvenience. I am not getting reply option to your latest feedback. I don't know what is wrong. 

    And to last post reply - 

    1. Yes, I have tried only current_setpoint_attribute() function also then also same problem. code line are not executing as marked in previous image. 

    2. I tried your suggestion also but still the same problem. You find the attached image where i am not able to put break point. 

    Should I share the code. but is same to last only thing is I have enabled more extended attributes. 

    Regards,

    Rohit R

  • Hi Marte, 

    Sorry for this inconvenience. I am not getting reply option to your latest feedback. I don't know what is wrong. 

    And to last post reply - 

    1. Yes, I have tried only current_setpoint_attribute() function also then also same problem. code line are not executing as marked in previous image. 

    2. I tried your suggestion also but still the same problem. You find the attached image where i am not able to put break point. 

    Should I share the code. but is same to last only thing is I have enabled more extended attributes. 

    Regards,

    Rohit R

  • Hi Marte, 

    Sorry for this inconvenience. I am not getting reply option to your latest feedback. I don't know what is wrong. 

    And to last post reply - 

    1. Yes, I have tried only current_setpoint_attribute() function also then also same problem. code line are not executing as marked in previous image. 

    2. I tried your suggestion also but still the same problem. You find the attached image where i am not able to put break point. 

    Should I share the code. but is same to last only thing is I have enabled more extended attributes. 

    Regards,

    Rohit R

  • Hi Marte, 

    Sorry for this inconvenience. I am not getting reply option to your latest feedback. I don't know what is wrong. 

    And to last post reply - 

    1. Yes, I have tried only current_setpoint_attribute() function also then also same problem. code line are not executing as marked in previous image. 

    2. I tried your suggestion also but still the same problem. You find the attached image where i am not able to put break point. 

    Should I share the code. but is same to last only thing is I have enabled more extended attributes. 

    Regards,

    Rohit R

Reply
  • Hi Marte, 

    Sorry for this inconvenience. I am not getting reply option to your latest feedback. I don't know what is wrong. 

    And to last post reply - 

    1. Yes, I have tried only current_setpoint_attribute() function also then also same problem. code line are not executing as marked in previous image. 

    2. I tried your suggestion also but still the same problem. You find the attached image where i am not able to put break point. 

    Should I share the code. but is same to last only thing is I have enabled more extended attributes. 

    Regards,

    Rohit R

Children
No Data
Related