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

ZigBee: implement callback called before attribute report reported because of Configure Report command

Hi! It is nice that the SDK implements internally the attribute reporting commands mechanism, but the thing is that I want to know when the reporting occurs, when implementing a server role for a specific cluster.


Consider such case that another client in the system has configured my end device to periodically report an attribute. The client did it using Configure Report command. Let's take for example a LocalTemperature attribute in Thermostat cluster ID. If the reporting interval is set to 1h then the best way would be to take a measurement just before reporting the attribute. Because of that I would like to have a single user callback which is called each time just before the SDK wants to report the attribute. I can't see any API which will help me to do it fast.

Instead I would have to override the default ZCL command handler and handle the Configure Report command on my own, set a periodic timer which will handle Attribute Reporting, and so on... This is a nonsense for me as the SDK implements all this stuff on its own. All I need is a simple callback called just before Attribute Report.


I'm not talking here about ZigBee device callback, because it handles only the situation when Attribute Report Request command is received, not the Configure Report command.

Looking forward to having some help to have the temperature reported through ZigBee always up-to-date.

Parents
  • Hi,

    Have you taken a look at how attribute reporting is implemented in the multi_sensor and the CLI example in the SDK? I think this will give you a good starting point for implementing temperature reporting.

    Best Regards,

    Marjeris

  • Hi,

    I know how to use attribute reporting. This is not what I asked for. I asked for synchronization between the Attribute Reporting and taking a measurement. In the multi_sensor example, the measurement is taken each one second. This is nonsense for me - why should I wake up my chip each one second if the attribute is reported each ten minute. I want to take the measurement just before reporting the attribute. This is what I asked for. I need some callback to be called just before reporting an attribute. There is nothing about that in the multi_sensor examples and in the CLI example.

  • Hi,

    I understand what you are asking about now, but unfortunately no there is such callback. What you could do is read ZB_ZCL_GET_REPORTING_FLAG(rep_info, ZB_ZCL_REPORT_ATTR) after each zboss_main_loop_iteration() and then taking the measurement. The rep_info you can get from

    zb_zcl_reporting_info_t* zb_zcl_find_reporting_info(  zb_uint8_t ep,
    
                                                          zb_uint16_t cluster_id,
    
                                                          zb_uint8_t cluster_role,
    
                                                          zb_uint16_t attr_id);

    The problem with this is that you never know if somebody subscribed to reporting through attribute value changes instead of periodically report, so there could be a case when you don't measure the value at all.

    Best Regards,

    Marjeris

Reply
  • Hi,

    I understand what you are asking about now, but unfortunately no there is such callback. What you could do is read ZB_ZCL_GET_REPORTING_FLAG(rep_info, ZB_ZCL_REPORT_ATTR) after each zboss_main_loop_iteration() and then taking the measurement. The rep_info you can get from

    zb_zcl_reporting_info_t* zb_zcl_find_reporting_info(  zb_uint8_t ep,
    
                                                          zb_uint16_t cluster_id,
    
                                                          zb_uint8_t cluster_role,
    
                                                          zb_uint16_t attr_id);

    The problem with this is that you never know if somebody subscribed to reporting through attribute value changes instead of periodically report, so there could be a case when you don't measure the value at all.

    Best Regards,

    Marjeris

Children
Related