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

How to declare client poll control cluster in a Zigbee coordinator for an IAS zone device

Hello Nordic support,

I am working on a Zigbee coordinator application to make it work with an IAS zone Zigbee device.

As per the Zigbee device specification, ''when it starts up, it auto scans for client poll control cluster on the coordinator. If it is support on the coordinator an auto bind is created and the sensor will send a check-in command in the interval specified in attribute “Check-in Interval. The coordinator has to reply with a check-in response". 

So, in the coordinator code, I have declared the clusters as follows:

typedef struct
{
  zb_zcl_basic_attrs_ext_t  ias_sensor_basic_attr;
  zb_zcl_identify_attrs_t ias_sensor_identify_attr;
  zb_zcl_ias_zone_attrs_t ias_sensor_iaszone_attr;
  zb_zcl_poll_control_attrs_t ias_sensor_pollctrl_attr;
}ias_sensor_window_device_ctx_t;

static ias_sensor_device_ctx_t m_ias_sensor_device_ctx;

static zb_uint8_t         ias_sensor_attr_zcl_version   = ZB_ZCL_VERSION;
static zb_uint8_t         ias_sensor_attr_power_source  = ZB_ZCL_BASIC_POWER_SOURCE_BATTERY;
static zb_uint16_t        ias_sensor_attr_identify_time = 0;
static zb_uint8_t         ias_sensor_attr_zone_state    = 0;
static zb_uint16_t        ias_sensor_attr_zone_type     = 0x0015;
static zb_uint16_t        ias_sensor_attr_zone_status   = 0;
static zb_uint64_t        ias_sensor_attr_ias_cie_addr  = 0;
static zb_uint8_t         ias_sensor_attr_zoneid        = 0;
static zb_uint16_t        ias_sensor_attr_cie_short_addr = 0;
static zb_uint8_t         ias_sensor_attr_cie_ep        = 0;
static zb_uint8_t         ias_sensor_attr_battvoltage   = 0;
static zb_uint32_t        ias_sensor_attr_checkin_intvl = 3600;
static zb_uint32_t        ias_sensor_attr_checkin_intvl_min = ZB_ZCL_POLL_CONTROL_CHECKIN_INTERVAL_MIN_DEFAULT_VALUE;
static zb_uint32_t        ias_sensor_attr_longpoll_intvl = ZB_ZCL_POLL_CONTROL_LONG_POLL_INTERVAL_MIN_DEFAULT_VALUE;
static zb_uint32_t        ias_sensor_attr_longpoll_intvl_min = ZB_ZCL_POLL_CONTROL_LONG_POLL_INTERVAL_MIN_DEFAULT_VALUE;
static zb_uint16_t        ias_sensor_attr_shortpoll_intvl = 3;
static zb_uint16_t        ias_sensor_attr_fastpoll_timeout = 300;
static zb_uint16_t        ias_sensor_attr_fastpoll_timeout_max = ZB_ZCL_POLL_CONTROL_FAST_POLL_TIMEOUT_MAX_DEFAULT_VALUE;

/* Declare attribute list for Basic cluster. */
ZB_ZCL_DECLARE_BASIC_ATTRIB_LIST(IAS_SENSOR_basic_attr_list, &ias_sensor_attr_zcl_version, &ias_sensor_attr_power_source);

/* Declare attribute list for Identify cluster. */
ZB_ZCL_DECLARE_IDENTIFY_ATTRIB_LIST(IAS_SENSOR_identify_attr_list, &ias_sensor_attr_identify_time);

/* Declare attribute list for IAS Zone cluster. */
ZB_ZCL_DECLARE_IAS_ZONE_ATTRIB_LIST(IAS_SENSOR_iaszone_attr_list, &ias_sensor_attr_zone_state, &ias_sensor_attr_zone_type, &ias_sensor_attr_zone_status, &ias_sensor_attr_ias_cie_addr, &ias_sensor_attr_cie_short_addr, &ias_sensor_attr_cie_ep);

/* Declare attribute list for Poll Control cluster. */
ZB_ZCL_DECLARE_POLL_CONTROL_ATTRIB_LIST(IAS_SENSOR_WINDOW_pollctrl_attr_list, &ias_sensor_attr_checkin_intvl, &ias_sensor_attr_longpoll_intvl, &ias_sensor_attr_shortpoll_intvl, &ias_sensor_attr_fastpoll_timeout, &ias_sensor_attr_checkin_intvl_min, &ias_sensor_attr_longpoll_intvl_min, &ias_sensor_attr_fastpoll_timeout_max);

/* Declare cluster list for IAS Zone device */
ZB_HA_DECLARE_IAS_ZONE_CLUSTER_LIST_COORD(ias_sensor_window_clusters, IAS_SENSOR_basic_attr_list, IAS_SENSOR_identify_attr_list, IAS_SENSOR_iaszone_attr_list, IAS_SENSOR_pollctrl_attr_list);

ZB_HA_DECLARE_IAS_ZONE_EP(ias_zone_ep, HA_IAS_ZONE_ENDPOINT, ias_sensor_window_clusters);

ZB_HA_DECLARE_IAS_ZONE_CTX(ias_zone_ctx, ias_zone_ep);

In the main function, I have used the following function calls:

UNUSED_RETURN_VALUE(ZB_MEMSET(&m_ias_sensor_device_ctx, 0, sizeof(ias_sensor_device_ctx_t)));

/* Register callback for handling ZCL commands. */
ZB_ZCL_REGISTER_DEVICE_CB(ias_sensor_zcl_cmd_cb);

ZB_AF_REGISTER_DEVICE_CTX(&ias_zone_ctx);

However, when the Zigbee device starts up, even though it is discovered by the coordinator as indicated by the event ZB_ZDO_SIGNAL_DEVICE_ANNCE, the registered callback 'ias_sensor_zcl_cmd_cb' is not called. I believe this means the device is not able to find the client poll cluster. 

Could you please provide inputs to resolve this?

Regards,

Anusha

Parents
  • Hi Anusha,

    If the callback ias_sensor_zcl_cmd_cb is not called, then it means that the device does not receive any ZCL commands, as when you register a callback with ZB_ZCL_REGISTER_DEVICE_CB, you set a callback to be used when the device receives ZCL commands, and you want the application to handle the commands in specific way. Does it enter the callback if you try to send other ZCL commands to the device? Do you have a specific case for ZB_ZCL_POLL_CONTROL_CHECK_IN_CLI_CB_ID in your callback function?

    I see that you are using both ias_sensor_window_device_ctx_t and ias_sensor_device_ctx_t, and that only the latter is used later on, at least in the code you have shared here. Are these two different device contexts, and the sensor window device context is used somewhere else, or are they supposed to be the same? Besides this the code you have shared looks correct, and your clusters are declared correctly as far as I can see.

    You can try to test if you are able to interact with the poll control cluster at all, if you have other devices you can use for this. This might not solve the problem, as you might be able to interact with it even if there is something wrong causing the other device to not find it, but you will at least be able to tell if other devices can find the cluster or not. If you have another DK or dongle, you can for example use the Zigbee CLI Agent example on the other device and send commands to the coordinator. After setting up the CLI agent, you can send commands such as a simple descriptor request, simple_desc_req, to get the simple descriptor of the device, which contains a list of in and out clusters. Then you will see whether the poll control cluster appears in the cluster lists or not. You can also try to read attributes of that cluster with zcl attr read.

    Best regards,

    Marte

Reply
  • Hi Anusha,

    If the callback ias_sensor_zcl_cmd_cb is not called, then it means that the device does not receive any ZCL commands, as when you register a callback with ZB_ZCL_REGISTER_DEVICE_CB, you set a callback to be used when the device receives ZCL commands, and you want the application to handle the commands in specific way. Does it enter the callback if you try to send other ZCL commands to the device? Do you have a specific case for ZB_ZCL_POLL_CONTROL_CHECK_IN_CLI_CB_ID in your callback function?

    I see that you are using both ias_sensor_window_device_ctx_t and ias_sensor_device_ctx_t, and that only the latter is used later on, at least in the code you have shared here. Are these two different device contexts, and the sensor window device context is used somewhere else, or are they supposed to be the same? Besides this the code you have shared looks correct, and your clusters are declared correctly as far as I can see.

    You can try to test if you are able to interact with the poll control cluster at all, if you have other devices you can use for this. This might not solve the problem, as you might be able to interact with it even if there is something wrong causing the other device to not find it, but you will at least be able to tell if other devices can find the cluster or not. If you have another DK or dongle, you can for example use the Zigbee CLI Agent example on the other device and send commands to the coordinator. After setting up the CLI agent, you can send commands such as a simple descriptor request, simple_desc_req, to get the simple descriptor of the device, which contains a list of in and out clusters. Then you will see whether the poll control cluster appears in the cluster lists or not. You can also try to read attributes of that cluster with zcl attr read.

    Best regards,

    Marte

Children
No Data
Related