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

Zigbee - Discover Attribute Request / Response

For a customer I am developing a Zigbee coordinator / Gateway with the nRF52840. As hardware I am using the nRF52840 Development Kit v2.0.1. As Software basis I use the “Zigbee cli example - Project” from the Thread and Zigbee SDK v4.0.0.

So far a lot of basic requests like “LQI” and “active endpoint” requests are working. But when I try to read out the Attributes of an endpoint I only get unexpected results as response.

As there are is no example for that in the cli Project, I only used the API Reference. I was able to send the request with my function “discover_attr_send(…)”. The function is called as callback after executing the api function “zb_buf_get_out_delayed_ext(…)”

static zb_void_t discover_attr_send(zb_bufid_t bufid, zb_uint16_t cb_param)

{

    zb_uint8_t row = cb_param;

    discover_attr_req_t * p_row = &(m_disc_attr_table[row]);

    p_row->seq_num = ZCL_CTX().seq_number;

    ZB_ZCL_GENERAL_DISC_READ_ATTR_REQ(bufid,                                                                                            

                                                                        ZB_ZCL_ENABLE_DEFAULT_RESPONSE,

                                                                        p_row->u16StartAttrID,

                                                                        p_row->u8MaxLen,

                                                                        p_row->u16TargetAddress,

                                                                        p_row->u8AddrMode,

                                                                        p_row->u8RemoteEP,

                                                                        zb_get_cli_endpoint(),

                                                                        ZB_AF_HA_PROFILE_ID,

                                                                        p_row->u16ClusterID,                                                                                                              

                                                                        cmd_zb_zcl_getDiscReadAtte_req_cb);

}

For example I want to read out the attributes of the On/Off Cluster (0x0006), endpoint 3 from the node with the short address “0x8dda”. So the parameters when sending the request look like this:

u16StartAttrID : 0

u8MaxLen : 11

u16TargetAddress : 0x8dda

u8AddrMode : 2

u8RemoteEP : 3

u16ClusterID : 6

As expected, after some time the callback function “cmd_zb_zcl_getDiscReadAtte_req_cb(…)” is called:

static zb_void_t cmd_zb_zcl_getDiscReadAtte_req_cb(zb_bufid_t bufid)

{

  zb_uint8_t complete = ZB_ZCL_DISC_NON_COMPLETE;

  zb_zcl_disc_attr_info_t *disc_attr_info;

 

  ZB_ZCL_GENERAL_GET_COMPLETE_DISC_RES(bufid, complete);

  ZB_ZCL_GENERAL_GET_NEXT_DISC_ATTR_RES(bufid, disc_attr_info);

  if (ZB_ZCL_DISC_COMPLETE == complete)

  {

    printf("Disc Attribute complete:\n ID: 0x%X\n Type: 0x%X\n", disc_attr_info->attr_id, disc_attr_info->data_type)

  }

  else

  {

  printf("Disc Attribute incomplete:\n ID: 0x%X\n Type: 0x%X\n", disc_attr_info->attr_id, disc_attr_info->data_type);

 } 

 zb_buf_free(bufid);

}

As result I always get an answers like this:

  1. Time:

Disc Attribute incomplete:

 ID: 0xC00

 Type: 0x0

  1. Time:

Disc Attribute incomplete:

 ID: 0xC01

 Type: 0x0

  1. Time:

Disc Attribute incomplete:

 ID: 0xC02

 Type: 0x0

That was not something I was expecting to receive as Answer, as the IDs don’t match with attributes of the On/Off Cluster. Can you tell me what I am doing wrong? Do you have example code of how to read out the attributes of a cluster?

 

Best Regards

Lutz

Parents Reply Children
No Data
Related