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 Marte, 

    Thank you for the response. 

    This is means I can use the signal_handler function like SDK 3.0. Override the function in main.c file. am I correct? 

    Okay, follow the steps suggested. 

    As you know that we are porting project from NXP to Nordic, I am stuck at one point where I am not understanding few APIs. means there are few functions in NXP code I am not finding alternative API in nRF or similar this function. I have referred SDK examples but I am not sure. 

    Please find the NXP attached files. As you can see they created function like 

    eCLD_ThermostatCommandHostSchedulePayloadSend()

    eZCL_CustomCommandSend() 

    eCLD_ThermostatCommandSetHostHolidayReceive() 

    eZCL_CustomCommandReceive() and others as server role and client role. 

    Can you please suggest me which API I have to replace here in nRF or any examples where such functions created.

    /*
     * app_thermostat_msp_command_handler.c
     *
     *  Created on: 16.05.2017
     *      Author: j.huebner
     */
    
    
    /****************************************************************************/
    /***        Include files                                                 ***/
    /****************************************************************************/
    #include <jendefs.h>
    #include "zps_gen.h"
    #include "App_Thermostat.h"
    #include "dbg.h"
    #include <string.h>
    #include "app_main.h"
    #include "app_events.h"
    #include "Thermostat.h"
    
    #include "app_thermostat_msp_commands.h"
    /****************************************************************************/
    /***        Macro Definitions                                             ***/
    /****************************************************************************/
    #ifdef DEBUG_APP_THERMOSTAT_MSP_COMMAND_HANDLER
        #define TRACE_MSP_HANDLER   TRUE
    #else
        #define TRACE_MSP_HANDLER   FALSE
    #endif
    
    #define THERMOSTAT_SETPOINTS_BUFFER_SIZE 56
    /****************************************************************************/
    /***        Type Definitions                                              ***/
    /****************************************************************************/
    /****************************************************************************/
    /***        Local Function Prototypes                                     ***/
    /****************************************************************************/
    PRIVATE void vMSP_COMMAND_decodeSwitchpoints(uint8 * u8ReceivedSwitchpoints, uint8 u8Switchpointslength);
    /****************************************************************************/
    /***        Exported Variables                                            ***/
    /****************************************************************************/
    /****************************************************************************/
    /***        Local Variables                                               ***/
    /****************************************************************************/
    /****************************************************************************/
    /***        Exported Functions                                            ***/
    /****************************************************************************/
    /****************************************************************************
     **
     ** NAME:       eCLD_ThermostatHandleSetpointRaiseOrLower
     **
     ** DESCRIPTION:
     ** Handles Thermostat Setpoint raise or lower command
     **
     ** PARAMETERS:               Name                      Usage
     ** ZPS_tsAfEvent            *pZPSevent                 Zigbee stack event structure
     ** tsZCL_EndPointDefinition *psEndPointDefinition      EP structure
     ** tsZCL_ClusterInstance    *psClusterInstance         Cluster structure
     **
     ** RETURN:
     ** teZCL_Status
     **
     ****************************************************************************/
    PUBLIC  teZCL_Status 		eCLD_ThermostatHandleSetHostSchedule(
                                ZPS_tsAfEvent               *pZPSevent,
                                tsZCL_EndPointDefinition    *psEndPointDefinition,
                                tsZCL_ClusterInstance       *psClusterInstance)
    {
    
        teZCL_Status eStatus;
        tsCLD_Thermostat_HostSchedulePayload sPayload;
        tsCLD_ThermostatCustomDataStructure *psCommon;
    
        /* Get pointer to custom data structure */
        psCommon = (tsCLD_ThermostatCustomDataStructure*)psClusterInstance->pvEndPointCustomStructPtr;
    
        /* Receive the command */
        eStatus = eCLD_ThermostatCommandHostScheduleReceive(
                                                pZPSevent,
                                                &u8TransactionSequenceNumber,
                                                &sPayload);
        if(eStatus != E_ZCL_SUCCESS)
        {
            DBG_vPrintf(TRACE_MSP_HANDLER, "eCLD_ThermostatCommandHostScheduleReceive Error: %d\r\n", eStatus);
            return (eStatus);
        }
    
    #ifdef MANUFACTURER_LEVARYS
    
    
    #ifdef   TRACE_ENABLED
        DBG_vPrintf(TRACE_MSP_HANDLER, "\n<----RECEIVE HOST SCHEDULE----> \r\n");
        int i = 0;
    
    	for (i = 0; i < THERMOSTAT_SETPOINTS_BUFFER_SIZE; i++) {
    
    		DBG_vPrintf(TRACE_MSP_HANDLER,"Set HOST SCHEDULE %d.Data =  %x  \r\n", i,sPayload.u8_ScheduleBuffer[i]);
    
    		if(i == 5 || i == 11 || i== 17 || i == 23 || i == 29 || i == 35 || i == 41){
    
    			DBG_vPrintf(TRACE_MSP_HANDLER,"\n");
    		}
    	}
    
    #endif
    
    	vMSP_COMMAND_decodeSwitchpoints(sPayload.u8_ScheduleBuffer,THERMOSTAT_SETPOINTS_BUFFER_SIZE);
    
    #endif
    
        /* call callback */
        psEndPointDefinition->pCallBackFunctions(&psCommon->sCustomCallBackEvent);
    
        return (E_ZCL_SUCCESS);
    }
    /****************************************************************************
     **
     ** NAME:       eCLD_ThermostatHandleSetHostHoliday
     **
     ** DESCRIPTION:
     ** Handles Thermostat Setpoint raise or lower command
     **
     ** PARAMETERS:               Name                      Usage
     ** ZPS_tsAfEvent            *pZPSevent                 Zigbee stack event structure
     ** tsZCL_EndPointDefinition *psEndPointDefinition      EP structure
     ** tsZCL_ClusterInstance    *psClusterInstance         Cluster structure
     **
     ** RETURN:
     ** teZCL_Status
     **
     ****************************************************************************/
    /*PUBLIC  teZCL_Status 		eCLD_ThermostatHandleSetHostHoliday(
                                ZPS_tsAfEvent               *pZPSevent,
                                tsZCL_EndPointDefinition    *psEndPointDefinition,
                                tsZCL_ClusterInstance       *psClusterInstance)
    {
    
        teZCL_Status eStatus;
        tsCLD_Thermostat_SetHostHolidayPayload sPayload;
        tsCLD_ThermostatCustomDataStructure *psCommon;
        DBG_vPrintf(TRACE_MSP_HANDLER, "RECEIVE HOST HOLIDAY \r\n");
         Get pointer to custom data structure
        psCommon = (tsCLD_ThermostatCustomDataStructure*)psClusterInstance->pvEndPointCustomStructPtr;
    
         Receive the command
        eStatus = eCLD_ThermostatCommandSetHostHolidayReceive(
                                                pZPSevent,
                                                &u8TransactionSequenceNumber,
                                                &sPayload);
        if(eStatus != E_ZCL_SUCCESS)
        {
            DBG_vPrintf(TRACE_MSP_HANDLER, "eCLD_ThermostatCommandSetHostHolidayReceive Error: %d\r\n", eStatus);
            return (eStatus);
        }
    
    
        DBG_vPrintf(TRACE_MSP_HANDLER, "Set HOST HOLIDAY 1.Data: %x und Last Data :%x \r\n", sPayload.u8_SetHolidayBuffer[0],sPayload.u8_SetHolidayBuffer[8]);
        memcpy(&sUartWandThermostat.p_Holiday[0], &sPayload.u8_SetHolidayBuffer[0],9 );
        sUartWandThermostat.SetDaten.ThermostatSetHoliday = TRUE;
         Message data for callback
        psCommon->sCallBackMessage.uMessage.psSetHostHolidayPayload= &sPayload;
    
         call callback
        psEndPointDefinition->pCallBackFunctions(&psCommon->sCustomCallBackEvent);
        // Send Uart Queue for writing host holiday by uart
    	  App_tsEventUart sAppUartEvent;
    	  sAppUartEvent.eType_UartNextState = UART_WRITE_THERMOSTAT_DATA;
    	  ZQ_bQueueSend(&APP_msgUartEvents, &sAppUartEvent);
        return (E_ZCL_SUCCESS);
    }*/
    
    /****************************************************************************
     **
     ** NAME:       eCLD_ThermostatHandleGetHostSchedule
     **
     ** DESCRIPTION:
     ** Handles Thermostat Setpoint raise or lower command
     **
     ** PARAMETERS:               Name                      Usage
     ** ZPS_tsAfEvent            *pZPSevent                 Zigbee stack event structure
     ** tsZCL_EndPointDefinition *psEndPointDefinition      EP structure
     ** tsZCL_ClusterInstance    *psClusterInstance         Cluster structure
     **
     ** RETURN:
     ** teZCL_Status
     **
     ****************************************************************************/
    PUBLIC  teZCL_Status 		eCLD_ThermostatHandleGetHostSchedule(
                                ZPS_tsAfEvent               *pZPSevent,
                                tsZCL_EndPointDefinition    *psEndPointDefinition,
                                tsZCL_ClusterInstance       *psClusterInstance)
    {
    	DBG_vPrintf(TRACE_MSP_HANDLER, "\nTRACE_MSP_HANDLER:                           eCLD_ThermostatHandleGetHostSchedule---------------------->\n" );
       // tsCLD_Thermostat_HostSchedulePayload sPayload;
    	u8TransactionSequenceNumber++;
        //tsCLD_ThermostatCustomDataStructure *psCommon;
       // uint16 u16ActualQuantity;
        void * thisNet = ZPS_pvAplZdoGetNwkHandle();
        ZPS_tsNwkNib * thisNib = ZPS_psNwkNibGetHandle(thisNet);
        tsCLD_Thermostat_HostSchedulePayload psPayload;
        tsZCL_Address sAddress;
    
        sAddress.eAddressMode = E_ZCL_AM_BOUND;
        sAddress.uAddress.u16DestinationAddress = thisNib->sTbl.psNtDisc[0].u16NwkAddr;
    
    	int8 i;
    	for (i = 0; i < 42; i++) {
    		psPayload.u8_ScheduleBuffer[i] = (0x03 + i);
    	}
    
    
        tsZCL_TxPayloadItem asPayloadDefinition[] = {{42,E_ZCL_ENUM8, &psPayload.u8_ScheduleBuffer},};
        DBG_vPrintf(TRACE_MSP_HANDLER, "\nAPP_MSP_COMMANDS:              u8TransactionSequenceNumber = %x",u8TransactionSequenceNumber);
    
    #ifdef DEBUG_APP_THERMOSTAT_MSP_COMMAND_HANDLER
        teZCL_Status eStatus =  	eZCL_CustomCommandSend(0x01,//u8SourceEndPointId,
    	  	  	   	   	   	   	   	u8DestinationEndpointID,//u8DestinationEndPointId,
    								&sAddress,
    								HVAC_CLUSTER_ID_THERMOSTAT,
    								TRUE,
    								E_CLD_THERMOSTAT_CMD_GET_HOST_SCHEDULE,
    								&u8TransactionSequenceNumber,
    								asPayloadDefinition,
    								TRUE,
    								ZCL_MANUFACTURER_CODE,
    								sizeof(asPayloadDefinition) / sizeof(tsZCL_TxPayloadItem));
    #else
        		eZCL_CustomCommandSend(0x01,//u8SourceEndPointId,
        				  	  	  	   u8DestinationEndpointID,//u8DestinationEndPointId,
        							   &sAddress,
        							   HVAC_CLUSTER_ID_THERMOSTAT,
        							   TRUE,
        							   E_CLD_THERMOSTAT_CMD_GET_HOST_SCHEDULE,
        							   &u8TransactionSequenceNumber,
        							   asPayloadDefinition,
        							   TRUE,
        							   ZCL_MANUFACTURER_CODE,
        							   sizeof(asPayloadDefinition) / sizeof(tsZCL_TxPayloadItem));
    #endif
    
    
    #ifdef DEBUG_APP_THERMOSTAT_MSP_COMMAND_HANDLER
    	if (E_ZCL_SUCCESS == eStatus) {
    		DBG_vPrintf(TRACE_MSP_HANDLER,"\neZCL_CustomCommandSend Status E_ZCL_SUCCESS \n");
    	} else if (E_ZCL_ERR_PARAMETER_NULL == eStatus) {
    		DBG_vPrintf(TRACE_MSP_HANDLER,"\neZCL_CustomCommandSend Status E_ZCL_ERR_PARAMETER_NULL \n");
    	} else if (E_ZCL_ERR_EP_RANGE == eStatus) {
    		DBG_vPrintf(TRACE_MSP_HANDLER,"\neZCL_CustomCommandSend Status E_ZCL_ERR_EP_RANGE \n");
    	} else if (E_ZCL_ERR_ATTRIBUTES_0 == eStatus) {
    		DBG_vPrintf(TRACE_MSP_HANDLER,"\neZCL_CustomCommandSend Status E_ZCL_ERR_ATTRIBUTES_0 \n");
    	} else if (E_ZCL_ERR_ZBUFFER_FAIL == eStatus) {
    		DBG_vPrintf(TRACE_MSP_HANDLER,"\neZCL_CustomCommandSend Status E_ZCL_ERR_ZBUFFER_FAIL \n");
    	} else if (E_ZCL_ERR_ZTRANSMIT_FAIL == eStatus) {
    		DBG_vPrintf(TRACE_MSP_HANDLER,"\neZCL_CustomCommandSend Status E_ZCL_ERR_ZTRANSMIT_FAIL \n");
    	} else if (E_ZCL_FAIL == eStatus) {
    		DBG_vPrintf(TRACE_MSP_HANDLER,"\neZCL_CustomCommandSend Status E_ZCL_FAIL \n");
    	} else if (E_ZCL_ERR_EP_UNKNOWN == eStatus) {
    		DBG_vPrintf(TRACE_MSP_HANDLER,"\neZCL_CustomCommandSend Status E_ZCL_ERR_EP_UNKNOWN \n");
    	}
    
    #endif
    	return (0);
    }
    /****************************************************************************
     **
     ** NAME:       vMSP_COMMAND_decodeSwitchpoints
     **
     ** DESCRIPTION:
     ** Handles Thermostat Switchpoints decoding
     **
     ** PARAMETERS:
     ** uint8 * u8ReceivedSwitch
     ** uint8 u8Switchpointslength
     **
     ** RETURN:
     ** void
     **
     ****************************************************************************/
    PRIVATE void vMSP_COMMAND_decodeSwitchpoints(uint8 * u8ReceivedSwitchpoints,uint8 u8Switchpointslength) {
    
    
    int8 i;
    	for (i = 1; i < 113; i++) {
    
    		u8decodedSwitchpointsArray[i] = 0xFF;
    
    	}
    // Send Switchpoint command
    	u8decodedSwitchpointsArray[0] = 0xFB;
    
    	uint8 u8switchPointOffsetHour;
    	uint8 u8switchPointOffsetMinute;
    
    	for (i = 0; i < 42; i++) {
    
    		if (SWITCHPOINT_MONTAG == i) {
    			u8switchPointOffsetHour = 1;//0
    			u8switchPointOffsetMinute = 2;//1
    
    		} else if (SWITCHPOINT_DIENSTAG == i) {
    			u8switchPointOffsetHour = 5;//4
    			u8switchPointOffsetMinute = 6;//5
    
    		} else if (SWITCHPOINT_MITTWOCH == i) {
    			u8switchPointOffsetHour = 9;//8
    			u8switchPointOffsetMinute = 10;//9
    
    		} else if (SWITCHPOINT_DONNERSTAG == i) {
    			u8switchPointOffsetHour = 13;//12
    			u8switchPointOffsetMinute = 14;//13
    
    		} else if (SWITCHPOINT_FREITAG == i) {
    			u8switchPointOffsetHour = 17;//16
    			u8switchPointOffsetMinute = 18;//17
    
    		} else if (SWITCHPOINT_SAMSTAG == i) {
    			u8switchPointOffsetHour = 21;//20
    			u8switchPointOffsetMinute = 22;//21
    
    		} else if (SWITCHPOINT_SONNTAG == i) {
    			u8switchPointOffsetHour = 25;//24
    			u8switchPointOffsetMinute = 26;//25
    
    		}
    		u8decodedSwitchpointsArray[i * 2 + u8switchPointOffsetHour] = (u8ReceivedSwitchpoints[i] * 10) / 60;
    		u8decodedSwitchpointsArray[i * 2 + u8switchPointOffsetMinute] =	(u8ReceivedSwitchpoints[i] * 10) % 60;
    
    	}
    
    	App_tsEventUart sAppUartEvent;
    	sAppUartEvent.eType_UartNextState = APP_E_EVENT_UART_SEND_SWITCHPOINTS;
    	ZQ_bQueueSend(&APP_msgUartEvents, &sAppUartEvent);
    }
    /****************************************************************************/
    /***        END OF FILE                                                   ***/
    /****************************************************************************/
    

    /*
     * app_thermostat_msp_commands.c
     *
     *  Created on: 15.05.2017
     *      Author: j.huebner
     */
    
    /****************************************************************************/
    /***        Include files                                                 ***/
    /****************************************************************************/
    #include "app_thermostat_msp_commands.h"
    #include "dbg_uart.h"
    #include "zcl_options.h"
    #include "Thermostat.h"
    /****************************************************************************/
    /***        Macro Definitions                                             ***/
    /****************************************************************************/
    #define THERMOSTAT_HOLIDAY_BUFFER_SIZE 9
    /****************************************************************************/
    /***        Type Definitions                                              ***/
    /****************************************************************************/
    /****************************************************************************/
    /***        Local Function Prototypes                                     ***/
    /****************************************************************************/
    /****************************************************************************/
    /***        Exported Variables                                            ***/
    /****************************************************************************/
    PUBLIC uint8 u8decodedSwitchpointsArray[113];
    /****************************************************************************/
    /***        Local Variables                                               ***/
    /****************************************************************************/
    /****************************************************************************/
    /***        Exported Functions                                            ***/
    /****************************************************************************/
    #ifdef THERMOSTAT_CLIENT
     /****************************************************************************
      **
      ** NAME:       eCLD_ThermostatCommandHostSchedulePayloadSend
      **
      ** DESCRIPTION:
      ** Builds and sends an thermostat cluster command
      **
      ** PARAMETERS:                                     Name                           Usage
      ** uint8                                           u8SourceEndPointId             Source EP Id
      ** uint8                                           u8DestinationEndPointId        Destination EP Id
      ** tsZCL_Address                                   *psDestinationAddress           Destination Address
      ** uint8                                           *pu8TransactionSequenceNumber   Sequence number Pointer
      ** tsCLD_Thermostat_HostSchedulePayload    			*psPayload                      Payload
      **
      ** RETURN:
      ** teZCL_Status
      **
      ****************************************************************************/
     PUBLIC teZCL_Status eCLD_Thermostat_SetHostHolidayPayloadSend(
                         uint8                                           u8SourceEndPointId,
                         uint8                                           u8DestinationEndPointId,
                         tsZCL_Address                                   *psDestinationAddress,
                         uint8                                           *pu8TransactionSequenceNumber,
    					 tsCLD_Thermostat_SetHostHolidayPayload   			*psPayload)
     {
    	    tsZCL_TxPayloadItem asPayloadDefinition[] = {
    	            {THERMOSTAT_HOLIDAY_BUFFER_SIZE,  E_ZCL_ENUM8,   &psPayload->u8_SetHolidayBuffer},
    	                                              };
    
    	    return (eZCL_CustomCommandSend(u8SourceEndPointId,
    	                                  u8DestinationEndPointId,
    	                                  psDestinationAddress,
    	                                  HVAC_CLUSTER_ID_THERMOSTAT,
    	                                  FALSE,
    									  E_CLD_THERMOSTAT_CMD_SET_HOST_HOLIDAY,
    	                                  pu8TransactionSequenceNumber,
    	                                  asPayloadDefinition,
    	                                  TRUE,
    									  ZCL_MANUFACTURER_CODE,
    	                                  sizeof(asPayloadDefinition) / sizeof(tsZCL_TxPayloadItem)));
     }
     /****************************************************************************
      **
      ** NAME:       eCLD_ThermostatCommandHostSchedulePayloadSend
      **
      ** DESCRIPTION:
      ** Builds and sends an thermostat cluster command
      **
      ** PARAMETERS:                                     Name                           Usage
      ** uint8                                           u8SourceEndPointId             Source EP Id
      ** uint8                                           u8DestinationEndPointId        Destination EP Id
      ** tsZCL_Address                                   *psDestinationAddress           Destination Address
      ** uint8                                           *pu8TransactionSequenceNumber   Sequence number Pointer
      ** tsCLD_Thermostat_HostSchedulePayload    			*psPayload                      Payload
      **
      ** RETURN:
      ** teZCL_Status
      **
      ****************************************************************************/
     PUBLIC teZCL_Status eCLD_ThermostatCommandHostSchedulePayloadSend(
                         uint8                                           u8SourceEndPointId,
                         uint8                                           u8DestinationEndPointId,
                         tsZCL_Address                                   *psDestinationAddress,
                         uint8                                           *pu8TransactionSequenceNumber,
     					tsCLD_Thermostat_HostSchedulePayload   			*psPayload)
     {
    	    tsZCL_TxPayloadItem asPayloadDefinition[] = {
    	            {56,                         E_ZCL_ENUM8,   &psPayload->u8_ScheduleBuffer},
    	                                              };
    
    	    return (eZCL_CustomCommandSend(u8SourceEndPointId,
    	                                  u8DestinationEndPointId,
    	                                  psDestinationAddress,
    	                                  HVAC_CLUSTER_ID_THERMOSTAT,
    	                                  FALSE,
    									  E_CLD_THERMOSTAT_CMD_SET_HOST_SCHEDULE,
    	                                  pu8TransactionSequenceNumber,
    	                                  asPayloadDefinition,
    	                                  TRUE,
    									  ZCL_MANUFACTURER_CODE,
    	                                  sizeof(asPayloadDefinition) / sizeof(tsZCL_TxPayloadItem)));
    
    
     }
    #endif
    
    #ifdef THERMOSTAT_SERVER
    /****************************************************************************
     **
     ** NAME:       eCLD_ThermostatCommandHostScheduleReceive
     **
     ** DESCRIPTION:
     ** handles rx of identify query response
     **
     ** PARAMETERS:                                     Name                          Usage
     ** ZPS_tsAfEvent                                   *pZPSevent                     Zigbee stack event structure
     ** uint8                                           *pu8TransactionSequenceNumber  Sequence number Pointer
     ** tsCLD_Thermostat_HostSchedulePayload   			 *psPayload                     Payload
     **
     ** RETURN:
     ** teZCL_Status
     **
     ****************************************************************************/
    PUBLIC teZCL_Status eCLD_ThermostatCommandSetHostHolidayReceive(
                        ZPS_tsAfEvent                                   *pZPSevent,
                        uint8                                           *pu8TransactionSequenceNumber,
    					tsCLD_Thermostat_SetHostHolidayPayload    		*psPayload)
    {
    	uint16 u16ActualQuantity;
    
    	    tsZCL_RxPayloadItem asPayloadDefinition[] = {
    	            {THERMOSTAT_HOLIDAY_BUFFER_SIZE,                             &u16ActualQuantity,             E_ZCL_ENUM8,           &psPayload->u8_SetHolidayBuffer},
    
    	                                                };
    
    	    return (eZCL_CustomCommandReceive(pZPSevent,
    	                                        pu8TransactionSequenceNumber,
    	                                        asPayloadDefinition,
    	                                        sizeof(asPayloadDefinition) / sizeof(tsZCL_RxPayloadItem),
    	                                        E_ZCL_ACCEPT_EXACT));
    
    }
    /****************************************************************************
     **
     ** NAME:       eCLD_ThermostatCommandHostScheduleReceive
     **
     ** DESCRIPTION:
     ** handles rx of identify query response
     **
     ** PARAMETERS:                                     Name                          Usage
     ** ZPS_tsAfEvent                                   *pZPSevent                     Zigbee stack event structure
     ** uint8                                           *pu8TransactionSequenceNumber  Sequence number Pointer
     ** tsCLD_Thermostat_HostSchedulePayload   			 *psPayload                     Payload
     **
     ** RETURN:
     ** teZCL_Status
     **
     ****************************************************************************/
    PUBLIC teZCL_Status eCLD_ThermostatCommandHostScheduleReceive(
    		ZPS_tsAfEvent *pZPSevent, uint8 *pu8TransactionSequenceNumber,
    		tsCLD_Thermostat_HostSchedulePayload *psPayload) {
    	uint16 u16ActualQuantity;
    
    	tsZCL_RxPayloadItem asPayloadDefinition[] = { {
    			THERMOSTAT_SETPOINTS_BUFFER_SIZE, &u16ActualQuantity, E_ZCL_ENUM8,&psPayload->u8_ScheduleBuffer },
    
    	};
    
    	return (eZCL_CustomCommandReceive(pZPSevent, pu8TransactionSequenceNumber,
    			asPayloadDefinition,
    			sizeof(asPayloadDefinition) / sizeof(tsZCL_RxPayloadItem),
    			E_ZCL_ACCEPT_EXACT));
    
    }
    #endif
    /****************************************************************************/
    /***        END OF FILE                                                   ***/
    /****************************************************************************/
    

    app_thermostat_msp_commands.h

    Thanks and Regards

    Rohit R

  • Hi Rohit,

    I am not sure what all of the functions you mention do, as I am not familiar with this Zigbee stack. It would be easier to help if you explained the desired functionality instead.

    In our SDK, the different clusters have macros to send cluster commands, so instead of using a general function like eCLD_ThermostatCommandHostSchedulePayloadSend, you should use the macros for each command. If you for example want to send the "Set Weekly Schedule" command, you would use ZB_ZCL_THERMOSTAT_SEND_SET_WEEKLY_SCHEDULE_REQ. These can be found in the thermostat cluster file, zb_zcl_thermostat.h. All of them start with "ZB_ZCL_THERMOSTAT_SEND", so you can just search for this inside the file. You can see an example of how to use these macros in the light switch example, where commands from the On/Off cluster are being sent, such as in the function light_switch_send_on_off:

        ZB_ZCL_ON_OFF_SEND_REQ(bufid,
                               m_device_ctx.bulb_params.short_addr,
                               ZB_APS_ADDR_MODE_16_ENDP_PRESENT,
                               m_device_ctx.bulb_params.endpoint,
                               LIGHT_SWITCH_ENDPOINT,
                               ZB_AF_HA_PROFILE_ID,
                               ZB_ZCL_DISABLE_DEFAULT_RESPONSE,
                               cmd_id,
                               NULL);

    For sending custom commands that are not cluster specific you must do the following:

    You can see examples of how to use this in the SDK.

    Best regards,

    Marte

  • 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 

  • 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

Related