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,

    Thank you for the details, 

    As of now, sending custom command is pending. I will work on this in some time. 

    But current requirement I am trying to enabled the required attributes list. With reference to your code and other I have created extended list also. 

    But unoccupied, min and max, local_calibration and etc are not getting highlighted from thermostat cluster. And also Battery percentage attribute also facing same problem. they are not getting highlighted and these are must attributes (mandatory ids). 

    I have tested in SDK 3.0 I am getting highlighted below points but in SDK 4.1 i am facing this issue. Let me know why?

    Below is the image attached for both cluster. And also my thermostat.h file please check what is wrong. Why I am not getting these attributes highlighted. 

    0508.zb_zcl_thermostat.h

    5807.zb_zcl_power_config.h

    Thanks and regards

    Rohit 

Reply
  • Hi Marte,

    Thank you for the details, 

    As of now, sending custom command is pending. I will work on this in some time. 

    But current requirement I am trying to enabled the required attributes list. With reference to your code and other I have created extended list also. 

    But unoccupied, min and max, local_calibration and etc are not getting highlighted from thermostat cluster. And also Battery percentage attribute also facing same problem. they are not getting highlighted and these are must attributes (mandatory ids). 

    I have tested in SDK 3.0 I am getting highlighted below points but in SDK 4.1 i am facing this issue. Let me know why?

    Below is the image attached for both cluster. And also my thermostat.h file please check what is wrong. Why I am not getting these attributes highlighted. 

    0508.zb_zcl_thermostat.h

    5807.zb_zcl_power_config.h

    Thanks and regards

    Rohit 

Children
  • Hi Marte, 

    Any update on this. 

    Urgent!

    Is there any difference in my file. 

    Thanks and Regards

    Rohit R

  • Hi Rohit,

    Have you looked at what the differences between the projects implemented in v4.1 and v3.0 are, since you only get this problem in v4.1?

    Your power config file is identical to the one already in the SDK, so the problem is not with the cluster file in this case. I also do not see anything in the thermostat cluster file that seem wrong, as you are adding the custom clusters correctly, and the custom extended attribute list is implemented correctly as well. The problem is more likely to be in the zb_custom_thermostat file or main file.

    Have you checked whether the problem can be with the manufacturer code, as it was previously? Since your attribute list for the thermostat cluster is different from the attribute list in the Zigbee Cluster Library specification, you must set your manufacturer code. In the other case you used zb_set_node_descriptor_manufacturer_code() to set it for the node descriptor. You can also try to set it when you create the cluster descriptions in the declaration of the device's cluster list, by changing ZB_ZCL_MANUF_CODE_INVALID to the manufacturer code.

    ZB_ZCL_CLUSTER_DESC(                                        \
      ZB_ZCL_CLUSTER_ID_THERMOSTAT,                             \
      ZB_ZCL_ARRAY_SIZE(thermostat_attr_list, zb_zcl_attr_t),   \
      (thermostat_attr_list),                                   \
      ZB_ZCL_CLUSTER_SERVER_ROLE,                               \
      MANUFACTURER_CODE                                         \ 
    ),                                                          \

    Best regards,

    Marte

  • Hi Marte, 

    I have compared .h files from both SDK 3.0 and SDK 4.1 both are same. 

    Have you checked whether the problem can be with the manufacturer code, as it was previously?

    - yes manufacturer code is = 0x1037 it is same defined. 

    - In SDK 3.0 I have kept ZB_ZCL_MANUF_CODE_INVALID in zb_custom_thermostat.h file. It worked here. 

    - And in SDK 4.1 I have changed to as per your suggestion. Please find the attached .h file for the same. 

    Still I see that attributes are not visible on GUI. 

    zb_custom1_thermostat.h

    - On node descriptor on GUI I can see that Power source = "Mains". How to set this battery? I have checked API for set but couldn't found anyone. 

    Thanks and Regards

    Rohit R

  • Hi Rohit,

    Rohit Rajapure said:
    I have compared .h files from both SDK 3.0 and SDK 4.1 both are same. 

     Did you compare both the cluster files and the zb_custom_thermostat file? What about main.c?

    Previously you were able to extend the thermostat attribute list with your custom attribute, and you were able to see it in the GUI. Have you made any other changes since that version besides adding more attributes to your attribute lists, both custom and not? Not just to the .h files, but the main.c file as well.

    I compared your latest zb_custom_thermostat file with the zb_custom_thermostat file I was sent by one of your colleagues previously. I cannot find any reason why the changes between the two should cause issues. Previously, there were only a few attributes in the thermostat attribute list, only local temperature, occupied heating setpoint and current setpoint. I do not know if the problem might be caused by specific attributes, by the number of attributes in the attribute list, or something else. Have you tried increasing the attribute list with just a few attributes at a time and testing with the GUI, to see when the problem arises, and to check if it is at a certain amount of attributes, or if there are specific attributes causing this? Since it did work previously you might be able to get some more information about what the problem can be doing this.

    It is also difficult to say what the problem might be by just looking at one file, as that does not give a complete picture of the project, and I am unable to test it.

    I do not know what options deCONZ has when it comes to debugging, as the attribute simply being grey does not help when trying to understand why the attribute is unsupported. When you send ZCL commands to the device, are you able to see the response from the device in deCONZ? If you send the Discover Attributes command, do you see the response? If so, are the attributes lacking in this response as well? Are you only able to send more general commands from somewhere in the program? For example, can you only read attributes using the "read" button above the attribute table, or are you able to send a Read Attributes command from somewhere where you can send ZCL commands? If you can, do you get any response when trying to send a Read Attributes command to one of the grey attributes?

    Rohit Rajapure said:
    How to set this battery?

     The power source attribute is part of the Basic cluster. Setting this attribute to ZB_ZCL_BASIC_POWER_SOURCE_BATTERY should fix this, but I see in your file zb_custom_thermostat.h that you have already defined THERMOSTAT_INIT_BASIC_POWER_SOURCE to be this. Have you tried reading this attribute to see what the value is?

    Best regards,

    Marte

  • Hi Marte, 

    Thank you for the response. 

    Yes, I have compared all the files but I didn't see any change. Even I have followed the same steps in SDK3.0 to enable attributes and here I can see that whatever attributes I have extended are visible and able to edit also. 

    But not possible in SDK 4.1. Attached is the code built in SDK 4.1. Hope this will help us to find reason. 

    to ZB_ZCL_BASIC_POWER_SOURCE_BATTERY should fix this, but I see in your file zb_custom_thermostat.h that you have already defined THERMOSTAT_INIT_BASIC_POWER_SOURCE to be this. Have you tried reading this attribute to see what the value is?

    - Yes, I have done that but still it shows main power source only. 

    0020.Radiator_nRF_v0.9.6.zip

    modified file, zb_zcl_thermostat.h file 

    2148.zb_zcl_thermostat.h

    Thanks and Regards

    Rohit R

Related