Login Register
ZigBee SDK - Status of the End Device
Dec 02, 2022 10:00




I based my project on the sampleContactSensor project in ZigBee SDK.

I can get the status indication in the Gateway through function sampleGW_iasZoneCb(), which uses zoneStatusChangeNoti_t, which is defined as:

* @brief Structure definition for zone status change notification command
typedef struct {
u16 zoneStatus;
u8 extStatus;
u8 zoneId;
u16 delay;
} zoneStatusChangeNoti_t;

Status of the sensor is return in "extStatus".

But since the End Device is sleeping, How can I get the current status of the device (sensor activated or not)?

Zone Cluster Attributes are defined as:

* @brief Defined for ias zone cluster attributes
typedef struct {
u8 zoneState;
u16 zoneType;
u16 zoneStatus;
extAddr_t iasCieAddr;
u8 zoneId;
u16 zoneDelay;

They have "zoneStatus" but no "extStatus".

Reading "zoneStatus" attribute always gives me 0x0000.

How can I get the current Status of the sensor?

How can I get "extStatus" - since this shows me the device status?

What is the "zoneStatus" used for, if it always returns 0x0000?

3 replies
wes58 [Author] Dec 02, 2022 12:09

I am not sure if that is the right way of doing this, but that s what I did:

When I create and sent zcl_iasZone_statusChangeNotificationCmd i will have to set status in g_zcl_iasZoneAttrs to 1 (ZONE_STATUS_BIT_ALARM1) or 0.

Is there a better/correct way of doing this?

TL_Soyo Dec 02, 2022 14:06


  You cant get sleep device state when it is sleeping, so you should save the data(in sampleGW_iasZoneCb) by yourself,

  you miss understand the two status,zcl_iasZoneAttr_t is for device ,and zoneStatusChangeNoti_t is for sensor,also,as spec says,it need extStatus always set to 0,use zoneStatus to indicate status,please refer to the Zigbee Cluster Library Specification.


wes58 [Author] Dec 02, 2022 18:23

Hi Soyo,

You said that I can't get sleep device state. That's what the poll control is, isn't it?

Sleepy end devices do not receive data directly from other devices on the network.
Instead, they must poll their parent for data and receive the data from their parent.
The parent acts as a surrogate for the sleepy device, staying awake and buffering
messages while the child sleeps.

And when I do what I wrote in my previous post I get the device state by reading cluster (0x0500) status attribute (0x0002).

And I am saving the status in the Gateway when I receive zoneStatusChangeNotification, but in case that I turn the gateway off and on, I want to confirm what the status is. And the device is sleeping because I can see very low current drawn, and I can see short current spikes - probably when polling occurs.

Also when I connect the debugger, I get memory read error when I try to read g_zcl_iasZoneAttrs - which I think means that the device is sleeping.

I will double check tomorrow that it is sleeping.