Zigbee network disconnection event not received

I am working on zigbee network.

I have seen that there is an event for network joining but could not find any event for network disconnection.

If I want to check that coordinator is there in the network or not, then how can I know, should I manually implement this or is there a way to check this, or to get the disconnection event?

Parents
  • Hi Marte,

    Thank you for reaching out.

    I want to achieve the ability to receive a disconnection event on my Zigbee Coordinator when a device leaves the network or powers off. Specifically, I want the Coordinator to be notified if an end device or router disconnects, either intentionally (through a leave request) or unintentionally (e.g., due to a power-off).

    The Zigbee device I am working on is a Coordinator.

    Best regards,


    Anil

  • Hi Anil,

    You can use the ZB_ZDO_SIGNAL_DEVICE_UPDATE signal in the stack event signal handler, zboss_signal_handler(). It is generated when a device joins, rejoins, or leaves the network. The status will indicate which it is:

    0x00 = Standard device secured rejoin
    0x01 = Standard device unsecured join
    0x02 = Device left
    0x03 = Standard device trust center rejoin

    You can also use the signal ZB_ZDO_SIGNAL_LEAVE_INDICATION.

    Here is an example code snippet for the ZB_ZDO_SIGNAL_DEVICE_UPDATE signal:

    void zboss_signal_handler(zb_bufid_t bufid)
    {
    	zb_zdo_app_signal_hdr_t *sig_hndler = NULL;
    	zb_zdo_app_signal_type_t sig = zb_get_app_signal(bufid, &sig_hndler);
    	zb_ret_t status = ZB_GET_APP_SIGNAL_STATUS(bufid);
    
    	switch (sig) {
    	case ZB_ZDO_SIGNAL_DEVICE_UPDATE:
    		zb_zdo_signal_device_update_params_t *update_params = ZB_ZDO_SIGNAL_GET_PARAMS(sig_hndler, zb_zdo_signal_device_update_params_t);
    		LOG_INF("Device update received (short: 0x%04hx, long: %s, status: %d)",
    			update_params->short_addr,
    			ieee_addr_buf,
    			update_params->status);
    
    		// Do something based on update_params->status
    		
    	break;
    	default:
    		/* Call default signal handler. */
    		ZB_ERROR_CHECK(zigbee_default_signal_handler(bufid));
    		break;
    	}
    
    	if (bufid) {
    		zb_buf_free(bufid);
    	}
    }

    Please note that this will only work for devices that send a leave command. If the coordinator is not able to communicate with a device due to power off or similar reasons, the coordinator will notice that it cannot reach the device when trying to communicate with it, and you will get route failures.

    An end device will eventually time out, but there is no automatic timeout in the same way for routers. However, using the neighbor table to check the age or transmit failure fields is possible. The age is the number of nwkLinkStatusPeriod intervals since the device last received a link status command (sort of a keep-alive message for routers and coordinators) from its neighbor, and the transmit failure field indicates if previous transmissions to the neighbor were successful or not. A high number in each of these fields would indicate that the router is offline or that the coordinator is not able to communicate with it.

    Best regards,
    Marte

  • Hi Marte,

    Thank you for reaching out.

    How can i received device power off and on in coordinator and If device was connected with via router then how to get LQI

    Best regards,
    Anil

  • Hi Anil.

    Dalvadi Anil said:
    How can i received device power off and on in coordinator

    As I said, if the device powers off, the coordinator will not receive any message that the device left the network, and you will have to wait for it to time out (end device) or check the age or transmit failure of the device (router). You can also check if a device is on the network by trying to send packets to it. If it does not respond, there is something wrong, like the device being offline, out of reach, or similar.

    Dalvadi Anil said:
    If device was connected with via router then how to get LQI

    The neighbor table contains information about LQI. If the device is in the neighbor table of the coordinator, then you can find the LQI by checking the neighbor table locally on the coordinator. If you want to see the LQI of a device not in the coordinator's neighbor table, then you can send a Mgmt_Lqi_req to get the neighbor table of the remote device. You can test this in the Zigbee shell sample with the zdo mgmt_lqi command.

    Best regards,
    Marte

Reply
  • Hi Anil.

    Dalvadi Anil said:
    How can i received device power off and on in coordinator

    As I said, if the device powers off, the coordinator will not receive any message that the device left the network, and you will have to wait for it to time out (end device) or check the age or transmit failure of the device (router). You can also check if a device is on the network by trying to send packets to it. If it does not respond, there is something wrong, like the device being offline, out of reach, or similar.

    Dalvadi Anil said:
    If device was connected with via router then how to get LQI

    The neighbor table contains information about LQI. If the device is in the neighbor table of the coordinator, then you can find the LQI by checking the neighbor table locally on the coordinator. If you want to see the LQI of a device not in the coordinator's neighbor table, then you can send a Mgmt_Lqi_req to get the neighbor table of the remote device. You can test this in the Zigbee shell sample with the zdo mgmt_lqi command.

    Best regards,
    Marte

Children
No Data
Related