cancel
Showing results for 
Search instead for 
Did you mean: 

Zigbee - Custom cluster attribute reporting only on connect

user5
Associate II

Hey,

I working on a project with the following goal: setup one central coordinator and let multiple sleepy end devices send sensor data periodically. For development I am trying to alter the code of the Zigbee_TempMeas_Client_Router/Zigbee_TempMeas_Server_Coord example projects, such that sending long strings is possible.

The setup is the following:

  • custom cluster with one reportable long string attribute
    static const struct ZbZclAttrT ZclTemp_AttrList[] = {
    {
    MY_ZCL_DEV_LS, ZCL_DATATYPE_STRING_LONG_CHARACTER,
    ZCL_ATTR_FLAG_REPORTABLE|ZCL_ATTR_FLAG_WRITABLE,
    512, // custom size
    NULL, // callback
    {0, 0}, //no value range
    {1, 10}
    }
    };
  • sleepy end devices run the server
  • coordinator runs the client and sends APP_ZIGBEE_Read_Temp_Attribute() request to the sleepy end devices
  • The custom attribute is changed between each call of APP_ZIGBEE_Temp_Meas_Read_cb(). APP_ZIGBEE_Temp_Meas_Read_cb() is unchanged with exeption of the attribute and readReq.dst.nwkAddr = 0xFFFF;
  • I configure the reporting similarily to the example
    static void APP_ZIGBEE_ReportConfig(void)
    {
    uint16_t rep_change = (uint16_t) ZCL_REPORT_CHANGE;
    struct ZbZclAttrReportConfigT report;
    report.dst.endpoint = SW1_ENDPOINT;
    report.dst.mode = ZB_APSDE_ADDRMODE_SHORT;
    report.dst.nwkAddr = 0x0000;
    report.num_records = 1;
    report.record_list[0].direction = ZCL_REPORT_DIRECTION_NORMAL;
    report.record_list[0].min = ZCL_MIN_REPORT; //10s
    report.record_list[0].max = ZCL_MAX_REPORT; //10s
    report.record_list[0].change = 0;
    report.record_list[0].attr_id = MY_ZCL_DEV_LS;
    report.record_list[0].attr_type = ZCL_DATATYPE_STRING_LONG_CHARACTER;
    ZbZclAttrReportConfigReq(zigbee_app_info.custom_ls_server,&report,&APP_ZIGBEE_Report_cb,(void*)&rep_change);

    }/*APP_ZIGBEE_ReportConfig*/

The problem:

  • The callback function APP_ZIGBEE_Temp_Meas_Read_cb() only reads the custom long string attribute succesfully once (when the sleepy end device joins the network) instead of each time, APP_ZIGBEE_Read_Temp_Attribute() is called. In all other cases, readRsp->count equals 0.

I would appreciate any help.

Best regards!

1 ACCEPTED SOLUTION

Accepted Solutions
Ouadi
ST Employee

Hi @user5 ,

Indeed, Zigbee_TempMeas_Client_Router and Zigbee_TempMeas_Server_Coord are not suitable for the SED configuration, as the router is sending a periodic Read command to the server to read measured temperature value. 

In your case, The server is configured as a SED and is not supposed to receive commands asynchronously as it goes to the sleep mode most of the time. As you mentioned it succeeds the first time when the device join the network as it is active.  

For your application such a Temperature sensor I recommend to use only the reporting to send periodically the measured values to the coordinator within the poll timeout, so no need to send read commands from the coordinator side.

Best regards,

Ouadi

View solution in original post

7 REPLIES 7
Ouadi
ST Employee

Hi @user5 ,

Indeed, Zigbee_TempMeas_Client_Router and Zigbee_TempMeas_Server_Coord are not suitable for the SED configuration, as the router is sending a periodic Read command to the server to read measured temperature value. 

In your case, The server is configured as a SED and is not supposed to receive commands asynchronously as it goes to the sleep mode most of the time. As you mentioned it succeeds the first time when the device join the network as it is active.  

For your application such a Temperature sensor I recommend to use only the reporting to send periodically the measured values to the coordinator within the poll timeout, so no need to send read commands from the coordinator side.

Best regards,

Ouadi

Hey Ouadi,

im not familiar with the Zigbee Stack. From reading your response, I think you are referring to the function ZbZclAttrReportKick to remotely report. From this point on I have two more questions, as my setup is still not working:
1) Can I assume, that calling ZbZclAttrReportKick on server side results in APP_ZIGBEE_Temp_ls_client_report being the corresponding callback on client side?

2) Is this the correct setup on client side? Especially the adressing is confusing me.

static void APP_ZIGBEE_ReportConfig(void)
{
uint16_t rep_change = (uint16_t) ZCL_REPORT_CHANGE;
struct ZbZclAttrReportConfigT report;
report.dst.endpoint = SW1_ENDPOINT;
report.dst.mode = ZB_APSDE_ADDRMODE_SHORT;
report.dst.nwkAddr = 0x0000;
report.num_records = 1;
report.record_list[0].direction = ZCL_REPORT_DIRECTION_NORMAL;
report.record_list[0].min = ZCL_MIN_REPORT;
report.record_list[0].max = ZCL_MAX_REPORT;
report.record_list[0].change = 0;
report.record_list[0].attr_id = MY_ZCL_DEV_LS;
report.record_list[0].attr_type = ZCL_DATATYPE_STRING_LONG_CHARACTER;
ZbZclAttrReportConfigReq(zigbee_app_info.custom_ls_server,&report,&APP_ZIGBEE_Report_cb,(void*)&rep_change);
}/*APP_ZIGBEE_ReportConfig*/

Hi

Reporting is done automatically by the stack when it is enabled, no need to call any API from server side, Callback APP_ZIGBEE_Temp_ls_client_report would be triggered with the configured reporting period .

The nwkAddr = 0 corresponds to the coordinator's address, if the coordinator is the client then you have to set the correct nwkAddr that you can catch at the join, or set a broadcast destination mode => report.dst.nwkAddr = 0xFFFF.

Regards,

Ouadi

user5
Associate II

Hey,

thanks for the patient help.

I am sending the configuration to the end device as it joins now, but receive back error 0xC3, UNSUPPORTED_CLUSTER.

Unfortunately, I cant find any information on this in the official stm api docs or manufacture specific cluster docs.

Best regards,

Martin

Ouadi
ST Employee

Hi,

Could you share the file "app_zigbee.c" for both projects ?

Thanks

Ouadi

user5
Associate II

Hi,

I am not able to share code publicly.

Best regards

Hi,

I am not able to share code publicly. Is it possible to get contacted?

Best regards