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

  • Hi,

    Any update to this?

    Why I am not able to see my IDs?

    Thanks and Regards

    Rohit R

  • Hi Rohit,

    I have been working on this today. Since I was unable to build the project you attached in your other case because of a missing file, I used the project I created earlier instead, and tried to create a custom cluster with a custom attribute.

    I created the files zb_zcl_custom_thermostat.h and zb_zcl_custom_thermostat.c for the cluster itself. This is a very bare bones implementation of the cluster, with only one attribute, but I hope it will still be of help. It should contain the necessary parts for a custom cluster. I used one of the attributes you mentioned in your other case, ZB_ZCL_ATTR_THERMOSTAT_VALVE_ID. Since I did not know anything specific about this attribute, I just chose something regarding attribute type and accesses, as well as the default value, so I would be able to test it. I did not implement any functionality in the cluster specific functions check value and write attribute hook. They are there for you to use, but they are mostly empty.

    Since you will be using a custom cluster, you cannot use the regular HA thermostat device anymore. Therefore, I also added a file zb_custom_ha_thermostat.h for a custom HA thermostat with the custom cluster added there. I also cleaned up the main.c file a bit and moved parts of it into the custom ha thermostat device file, as a lot of the code made more sense to have in this file. So a lot of the declarations and such at the beginning of the main.c file I attached earlier has been moved. I also just simulated some value for the thermostat valve attribute to test it.

    I have defined a cluster ID for the custom cluster and a profile ID for the custom HA thermostat device. These can both be changed to something else, as long as the IDs are not used by any other clusters or profiles, and the cluster ID must be in the range 0xfc00 – 0xffff, and the profile ID 0xc000 – 0xffff.

    I cannot say if this will work in your Gateway GUI or not. I did have some problems with attribute reporting, which does not work as expected, but I have not been able to figure out what the issue is yet. However, besides attribute reporting the custom cluster seemed to work as it is supposed to. Again I tested this using the CLI Agent example. I was able to use match descriptor (zdo match_desc) to find the device using the cluster ID of the custom cluster, and I was able to create a binding between the endpoints of the nodes (zdo bind on), also using the cluster ID. I was also able to read the value of the attribute ZB_ZCL_ATTR_THERMOSTAT_VALVE_ID by sending an read attributes request (zcl attr read). So even though there is a problem with attribute reporting, other nodes should be able to see and find this one and the custom cluster, as well as get the value of the attributes of the custom cluster.

    custom_ha_thermostat.zip

    Best regards,

    Marte

  • Hi Marte,

    Sorry for the late reply,

    I was out of station for few days,

    Thank you for the file and details.

    I have compared as well as tried your files into my project. But still, the result is the same. I am not able to see my Id in GUI.

    I have one dev-kit so can not try using CLI example but the gateway which I am using shows all the ID. I have tried with different examples in that I can see that GUI shows all ID.

    Also, along with this, I tried to add extra IDs, referred to the basic file to add. But still the result same. I have modified the SDK thermostat ha file. And that's fine for me. I am attaching the code for reference.

    I have added this in the light_bulb example file. Code built without any error but why IDs are not enabling understanding.

    Please check the code. I am using SDK 3.0 Zigbee and thread. And as per Zigbee cluster specification, it says "0x400 -0xfff Reserved for vendor-specific attributes".

    Radiator_nRF-v0.9.2.zip

    Thanks and Regards,

    Rohit R

  • Hi Rohit,

    It is difficult to say why it is not working with the Gateway GUI you are using, as I am not familiar with it and I do not know how it works.

    I will look at your project to see if I can figure out what the issue is and come back to you.

    Best regards,

    Marte

  • Hi Marte,

    I have tried one more method to add the required cluster into the project,

    Required cluster for the project,

    1. Basic

    2. Identity

    3. Power Configuration

    4. Thermostat

    5. Time

    6. OTAU

    I have referred multi_sensor example and created a separate custom1_thermosatat.h file like how they created it for the sensor.

    Tried to add the above-mentioned cluster. Currently in code added Basic, Identity, Power Configuration, thermostat, and Time.

    As I am stuck for custom attribute ID for the thermostat. Thought lets finish the power and time cluster part first. And waiting for your response.

    So, enabled both in code and just initialized the power id values in init() functions. As you can see in the attached code.

    With GUI I am able to see that, My cluster is added as per the .h file created. So next step I planned to initialize power's "Remaining percentage", "Voltage", "Size" and "Quantity".But I am not able to see those ids are highlighted.

    Attached is the image for reference (image of power config)

    For the Basic cluster, I have followed the same steps and you can see that whatever I initialized for the basic cluster I am able to see in GUI. Attached is the image for basic.

    (Image for Basic)

    Can you please help me with what else should be enabled here for power and other clusters?

    Code,

    Radiator_nRF_v0.9.3.zip

    Thanks and Regards

    Rohit R

Related