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

Reporting integer and octet string attributes on value change

Hello

I'm using the CLI example as ZC and a custom endnode based on the freeRTOS multisensor example (from nRF5 SDK for Thread and Zigbee v4.1.0).
Im trying to send a counter and an octet string via reporting only on status changes, but when configuring reporting only on status changes (setting the interval to 0 0) only the current data is sent, an nothing when updating.
Reading attributes manually responds with new data.

Setting up reporting with interval (1 60) sending updated values every 60 seconds but not on changes.

Can anyone point me in the right direction?

Thanks in advance

CLI setup and output:

> bdb start
Done
<info> app: Joined network successfully (Extended PAN ID: f4ce367de1aefa86, PAN ID: 0x4473)
<info> app: Device update received (short: 0x6471, long: f4ce3603f39a5577, status: 1)
<info> app: New device commissioned or rejoined (short: 0x6471)
<info> app: Device authorization event received (short: 0x6471, long: f4ce3603f39a5577, authorization type: 1, authorization status: 0)
> zdo bind on f4ce3603f39a5577 1 f4ce367de1aefa86 64 0xFC02 0x6471
>
Done
zcl subscribe on 0x6471 1 0xFC02 0x0104 0 35 0 0
> Done
zcl subscribe on 0x6471 1 0xFC02 0x0104 1 65 0 0
>
Error: Unable to configure attribute 1 reporting. Status: 134
Error: One or more attributes reporting were not configured successfully

<info> zigbee.report: Received value updates from the remote node 0x6471
<info> zigbee.report:     Profile: 0x0104 Cluster: 0xFC02 Attribute: 0x0000 Type: 35 Value: 2
<info> zigbee.report: Received value updates from the remote node 0x6471
<info> zigbee.report:     Profile: 0x0104 Cluster: 0xFC02 Attribute: 0x0001 Type: 65 Value: 01010c01010cf445707b4e57a7edaa658c8e2b55f35f3f7e1c473261fcb3291cd44de97b

Define of attributes:

#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DOOR_EVENT_COUNTER_ID(data_ptr)       \
{                                                                               \
    ZB_ZCL_ATTR_DOOR_EVENT_COUNTER_ID,                                          \
    ZB_ZCL_ATTR_TYPE_U32,                                                       \
    ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING,                \
    (zb_voidp_t) data_ptr                                                       \
}

#define ZB_SET_ATTR_DESCR_WITH_ZB_ZCL_ATTR_DOOR_EVENT_ID(data_ptr)              \
{                                                                               \
    ZB_ZCL_ATTR_DOOR_EVENT_ID,                                                  \
    ZB_ZCL_ATTR_TYPE_OCTET_STRING,                                              \
    ZB_ZCL_ATTR_ACCESS_READ_ONLY | ZB_ZCL_ATTR_ACCESS_REPORTING,                \
    (zb_voidp_t) data_ptr                                                       \
}

#define ZB_ZCL_DECLARE_AAGS_DOOR_ATTRIB_LIST(attr_list,                               \
                                             lock_event_ctr,                          \
                                             lock_event_data)                         \
  ZB_ZCL_START_DECLARE_ATTRIB_LIST(attr_list)                                         \
  ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DOOR_EVENT_COUNTER_ID, (lock_event_ctr))           \
  ZB_ZCL_SET_ATTR_DESC(ZB_ZCL_ATTR_DOOR_EVENT_ID, (lock_event_data))                  \
  ZB_ZCL_FINISH_DECLARE_ATTRIB_LIST

Code for setting values:

    ZB_ZCL_SET_STRING_VAL(m_dev_ctx.door_lock_attr.lock_event_data, data, length);
    m_dev_ctx.door_lock_attr.lock_event_counter++;

    // update values using reporting
    zcl_status = zb_zcl_set_attr_val(AAGS_DOOR_ENDPOINT, ZB_ZCL_CLUSTER_ID_AAGS,
                        ZB_ZCL_CLUSTER_SERVER_ROLE, ZB_ZCL_ATTR_DOOR_EVENT_ID,
                        m_dev_ctx.door_lock_attr.lock_event_data, ZB_FALSE);

    if(zcl_status != ZB_ZCL_STATUS_SUCCESS)
    {
        NRF_LOG_INFO("Set door event fail. zcl_status: %d", zcl_status);
    }
    else
    {
        char temp_buf[50];
        uint16_t len = to_hex_str(temp_buf, sizeof(temp_buf), data, length, false);
        if (len < 0)
        {
            strcpy(temp_buf, "No data");
        }
        NRF_LOG_INFO("Door event sent: %s", NRF_LOG_PUSH(temp_buf));

    }

    zcl_status = zb_zcl_set_attr_val(AAGS_DOOR_ENDPOINT, ZB_ZCL_CLUSTER_ID_AAGS,
                        ZB_ZCL_CLUSTER_SERVER_ROLE, ZB_ZCL_ATTR_DOOR_EVENT_COUNTER_ID,
                        (zb_uint8_t *)&m_dev_ctx.door_lock_attr.lock_event_counter, ZB_FALSE);

    if(zcl_status != ZB_ZCL_STATUS_SUCCESS)
    {
        NRF_LOG_INFO("Set event number fail. zcl_status: %d", zcl_status);
    }
    else
    {
        NRF_LOG_INFO("event number sent: %d", m_dev_ctx.door_lock_attr.lock_event_counter);
    }

wireshark capture:

No. Time    Source  Destination Protocol    Length  Info    Destination Endpoint    Data    String
836614  16:24:35,722240 0x0000  Broadcast   ZigBee ZDP  82  Permit Join Request 0       
836646  16:24:46,633873 f4:ce:36:03:f3:9a:55:77 0x0000  IEEE 802.15.4   47  Association Request, RFD            
836652  16:24:46,905159 0x0000  Broadcast   ZigBee  73  Link Status         
836658  16:24:47,119585 f4:ce:36:03:f3:9a:55:77 0x0000  IEEE 802.15.4   44  Data Request            
836660  16:24:47,123315 f4:ce:36:7d:e1:ae:fa:86 f4:ce:36:03:f3:9a:55:77 IEEE 802.15.4   53  Association Response, PAN: 0x4473 Addr: 0x6471          
836678  16:24:47,700797 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836680  16:24:47,706762 0x0000  0x6471  ZigBee  115 Transport Key           
836682  16:24:47,713802 0x6471  Broadcast   ZigBee ZDP  91  Device Announcement, Nwk Addr: 0x6471, Ext Addr: NordicSe_03:f3:9a:55:77    0       
836684  16:24:47,765355 0x6471  Broadcast   ZigBee ZDP  91  Device Announcement, Nwk Addr: 0x6471, Ext Addr: NordicSe_03:f3:9a:55:77    0       
836685  16:24:47,791953 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836687  16:24:47,809314 0x6471  0x0000  ZigBee  82  End Device Timeout Request          
836692  16:24:47,886339 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836694  16:24:47,890598 0x0000  0x6471  ZigBee  82  End Device Timeout Response, Success            
836697  16:24:47,976518 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836700  16:24:48,115853 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836708  16:24:48,253850 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836710  16:24:48,258274 0x0000  0x6471  ZigBee  87  APS: Ack, Dst Endpt: 0, Src Endpt: 0    0       
836714  16:24:48,344714 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836716  16:24:48,348771 0x0000  0x6471  ZigBee ZDP  104 Node Descriptor Response, Rev: 22, Nwk Addr: 0x0000, Status: Success    0       
836718  16:24:48,356048 0x6471  0x0000  ZigBee  87  APS: Ack, Dst Endpt: 0, Src Endpt: 0    0       
836720  16:24:48,361096 0x6471  0x0000  ZigBee  100 Request Key         
836723  16:24:48,444083 0x0000  0x6471  ZigBee  132 Transport Key           
836726  16:24:48,529568 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836728  16:24:48,535610 0x0000  0x6471  ZigBee  109 Confirm Key, SUCCESS            
836732  16:24:48,564411 0x6471  Broadcast   ZigBee ZDP  82  Permit Join Request 0       
836735  16:24:48,621362 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836740  16:24:48,712866 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836743  16:24:48,851488 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836747  16:24:49,050701 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836750  16:24:49,339113 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836755  16:24:49,767811 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836757  16:24:50,410034 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836769  16:24:51,373420 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836784  16:24:52,803563 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836788  16:24:54,955795 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836815  16:24:57,929383 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836841  16:25:00,904832 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836847  16:25:01,926929 0x0000  Broadcast   ZigBee  73  Link Status         
836851  16:25:03,877400 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836891  16:25:15,726534 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836896  16:25:16,919921 0x0000  Broadcast   ZigBee  73  Link Status         
836909  16:25:19,668603 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836929  16:25:23,614436 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
836975  16:25:27,560269 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837009  16:25:31,504539 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837012  16:25:31,927160 0x0000  Broadcast   ZigBee  73  Link Status         
837025  16:25:35,450657 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837027  16:25:35,454893 0x0000  0x6471  ZigBee ZDP  109 Bind Request, Manufacturer Specific (Cluster ID: 0xfc02) Src: NordicSe_03:f3:9a:55:77, Dst: NordicSe_7d:e1:ae:fa:86 0       
837028  16:25:35,463036 0x6471  0x0000  ZigBee  87  APS: Ack, Dst Endpt: 0, Src Endpt: 0    0       
837030  16:25:35,467418 0x6471  0x0000  ZigBee ZDP  89  Bind Response, Status: Success  0       
837032  16:25:35,543760 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837034  16:25:35,549450 0x0000  0x6471  ZigBee  87  APS: Ack, Dst Endpt: 0, Src Endpt: 0    0       
837036  16:25:35,635554 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837050  16:25:39,584236 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837058  16:25:43,528532 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837060  16:25:43,534453 0x0000  0x6471  ZigBee HA   102 ZCL: Configure Reporting, Seq: 26   1       
837062  16:25:43,540633 0x6471  0x0000  ZigBee  87  APS: Ack, Dst Endpt: 64, Src Endpt: 1   64      
837064  16:25:43,546968 0x6471  0x0000  ZigBee HA   91  ZCL: Configure Reporting Response, Seq: 26  64      
837067  16:25:43,624773 0x0000  0x6471  ZigBee  87  APS: Ack, Dst Endpt: 1, Src Endpt: 64   1       
837069  16:25:43,711147 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837071  16:25:43,802941 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837073  16:25:43,942582 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837075  16:25:44,139201 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837077  16:25:44,429567 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837080  16:25:44,859094 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837102  16:25:45,496249 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837117  16:25:46,457825 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837120  16:25:46,919325 0x0000  Broadcast   ZigBee  73  Link Status         
837124  16:25:47,891345 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837141  16:25:50,039717 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837143  16:25:50,122215 0x6471  0x0000  ZigBee HA   97  ZCL: Report Attributes, Seq: 0  64      
837145  16:25:50,191462 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837147  16:25:50,197171 0x0000  0x6471  ZigBee  87  APS: Ack, Dst Endpt: 1, Src Endpt: 64   1       
837149  16:25:50,204175 0x6471  0x0000  ZigBee HA   133 ZCL: Report Attributes, Seq: 1  64      
837151  16:25:50,283881 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837153  16:25:50,288302 0x0000  0x6471  ZigBee  87  APS: Ack, Dst Endpt: 1, Src Endpt: 64   1       
837154  16:25:50,375982 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837156  16:25:50,381695 0x0000  0x6471  ZigBee  87  APS: Ack, Dst Endpt: 1, Src Endpt: 64   1       
837158  16:25:50,515624 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837161  16:25:50,653315 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837167  16:25:51,140608 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837169  16:25:51,569944 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837178  16:25:52,209267 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837190  16:25:53,168910 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837203  16:25:54,603085 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837219  16:25:56,751793 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837237  16:25:59,723687 0x6471  0x0000  IEEE 802.15.4   38  Data Request            
837256  16:26:01,940474 0x0000  Broadcast   ZigBee  73  Link Status         

Parents
  • Hi,

    In order to configure attribute reporting for status change you need to modify the CLI example. One of my colleagues did this in the comment here in another case. There they tested it using the multi sensor example and configured it to report after a button press, but you should be able to use this and change it to report on value change. Could you take a look at how he implemented this and see if you are able to use this in your project?

    Additionally, there seem to be something wrong with the implementation of your attribute, or the command you are using to subscribe to that attribute, since you are getting an error. Status 134 is ZB_ZCL_STATUS_UNSUP_ATTRIB, which is unsupported attribute. I cannot see anything wrong in the code where you define the attributes. Did you look at the multi sensor example and the pressure measurement cluster when creating your custom cluster? If not, I recommend checking it out, as the pressure measurement is implemented in the application, available as a reference when implementing a custom cluster.

    Best regards,

    Marte

Reply
  • Hi,

    In order to configure attribute reporting for status change you need to modify the CLI example. One of my colleagues did this in the comment here in another case. There they tested it using the multi sensor example and configured it to report after a button press, but you should be able to use this and change it to report on value change. Could you take a look at how he implemented this and see if you are able to use this in your project?

    Additionally, there seem to be something wrong with the implementation of your attribute, or the command you are using to subscribe to that attribute, since you are getting an error. Status 134 is ZB_ZCL_STATUS_UNSUP_ATTRIB, which is unsupported attribute. I cannot see anything wrong in the code where you define the attributes. Did you look at the multi sensor example and the pressure measurement cluster when creating your custom cluster? If not, I recommend checking it out, as the pressure measurement is implemented in the application, available as a reference when implementing a custom cluster.

    Best regards,

    Marte

Children
  • Thanks, I have modified the CLI example and reporting on status change works fine.
    It's a little bit weird that there is an error message, but the reporting seems to work anyway and attrib read works without any issues.

    By the way, is there a way to increase the number of "message buffers" for reporting. Quite often the events are over written before they are sent.

  • Hi,

    Good to hear that you are able to report on status change!

    I am afraid there is no way to increase this as far as I know. Most of the actions related to the attribute reporting configuration are implemented as internal parts of the ZBOSS stack, and thus not visible to or configurable by the application. 

    Best regards,

    Marte

  • Is there anywhere I need to add support for reporting octet strings in CLI example?

    Reporting works fine when I change from ZB_ZCL_ATTR_TYPE_OCTET_STRING to ZB_ZCL_ATTR_TYPE_CHAR_STRING

    I previously added support for printing reading of octet strings in the example..

  • Hi,

    I am not certain about this, as there are no attributes in the Zigbee cluster library specification that are of the type octet string that are reportable. All the clusters that are octet strings are only readable and/or writable, so following this specification, there should be no need to support octet strings when it comes to attribute reporting. However, as far as I know, there are no character string reportable attributes either, so I cannot think of any reason why octet string should cause problems, but not character string.

    One suggestion is to look at how read attribute value is done in CLI, and compare that to attribute reporting, as the read attribute should at least have support for octet strings, as all attributes of that type in the ZCL spec are readable. You can find the CLI library for attribute reporting in the file components/zigbee/cli/zigbee_cli_cmd_attr_report.c, and for attribute read/write in components/zigbee/cli/zigbee_cli_cmd_attr.c. The relevant functions would be cli_agent_ep_handler_report() and cli_agent_ep_handler_attr(), which are handlers to intercept the frames for attribute reporting and read attribute respectively, and the print functions for the two, print_attr_update() and print_read_attr_response(), which are called in the handlers. Please be aware that the print function for zcl attr read command will print out the received response, while the print function for attribute reporting it will add the attribute value to the log, and it will only be printed if you enable displaying of reports.

    Best regards,

    Marte

Related