How to Retrieve a List of All Devices Connected in a Zigbee Network Using nRF Connect SDK?

I am working on zigbee network


"In a Zigbee network, how can the coordinator retrieve the list of all devices connected to the network?"

What is the recommended way to maintain an up-to-date list of all devices in a Zigbee network using the nRF Connect SDK?

Parents
  • Hi,

    "In a Zigbee network, how can the coordinator retrieve the list of all devices connected to the network?"

    An answer from our AI helper gives you some generic hints for how to do this

    To retrieve the list of all devices connected to a Zigbee network, the coordinator can use the Management LQI (Link Quality Indicator) request. This request allows the coordinator to obtain information about its neighboring devices, including their network addresses and other details. Here's how you can do this:

    1. Use the `zb_zdo_mgmt_lqi_req()` function to send a Management LQI request. This function is part of the ZBOSS Zigbee stack used in Nordic Semiconductor's Zigbee solutions.

    2. Set the destination address (`dst_addr`) parameter to the coordinator's own short address. This will retrieve the information about devices directly connected to the coordinator.

    3. Implement a callback function to handle the response from the Management LQI request. This callback will receive the information about the neighboring devices.

    To get a complete list of all devices in the network, you may need to send this request to each router in the network as well, as they might have additional devices connected to them.

    It's worth noting that executing this request frequently (e.g., every 3-5 seconds) might affect the Zigbee network performance, so it should be used judiciously.

    For more detailed information on using the Management LQI request and handling its response, you can refer to the https://developer.nordicsemi.com/nRF_Connect_SDK/doc/zboss/3.12.1.0/group__zdo__mgmt.html#ga231ec009bd8d5fffa218f30b9e5f089f

    What is the recommended way to maintain an up-to-date list of all devices in a Zigbee network using the nRF Connect SDK?

    You can for instance

    1. Use the Management LQI request periodically:
    As mentioned in the previous answer, you can use the `zb_zdo_mgmt_lqi_req()` function to retrieve information about neighboring devices. However, to get a complete picture of the network, you'll need to send this request to the coordinator and all routers in the network.

    2. Implement device join and leave callbacks:
    The nRF Connect SDK provides callbacks for device joining and leaving events. You can use these to keep your device list up-to-date in real-time.

    - For device joins, implement the `ZB_ZDO_SIGNAL_DEVICE_ANNCE` callback.
    - For device leaves, implement the `ZB_ZDO_SIGNAL_LEAVE` callback.

    3. Use the Zigbee Device Object (ZDO) callbacks:
    Implement the `ZB_ZCL_REGISTER_DEVICE_CB()` function to register callbacks for various Zigbee events, including device joins and leaves.

    Here's an example of how you might implement this:

    void zboss_signal_handler(zb_bufid_t bufid)
    {
        zb_zdo_app_signal_hdr_t *sg_p = NULL;
        zb_zdo_app_signal_type_t sig = zb_get_app_signal(bufid, &sg_p);
    
        switch (sig) {
            case ZB_ZDO_SIGNAL_DEVICE_ANNCE:
                // Handle new device join
                handle_device_join(sg_p);
                break;
            case ZB_ZDO_SIGNAL_LEAVE:
                // Handle device leave
                handle_device_leave(sg_p);
                break;
            // ... handle other signals as needed
        }
    
        if (bufid) {
            zb_buf_free(bufid);
        }
    }
    
    void device_cb(zb_bufid_t bufid)
    {
        zb_zcl_device_callback_param_t *device_cb_param =
            ZB_BUF_GET_PARAM(bufid, zb_zcl_device_callback_param_t);
    
        switch (device_cb_param->device_cb_id) {
            case ZB_ZCL_DEVICE_CB_ID_DEVICE_ANNCE:
                // Handle device announce
                break;
            case ZB_ZCL_DEVICE_CB_ID_LEAVE:
                // Handle device leave
                break;
            // ... handle other device callbacks as needed
        }
    }
    
    void main(void)
    {
        // ... other initialization code
    
        ZB_ZCL_REGISTER_DEVICE_CB(device_cb);
    
        // ... start Zigbee network
    }

    This approach allows you to maintain an up-to-date list of devices by:
    1. Periodically using the Management LQI request to get a full picture of the network.
    2. Updating the list in real-time as devices join or leave the network.

    Remember to handle the responses from the Management LQI requests and update your device list accordingly.

    For more detailed information on implementing these callbacks and handling Zigbee events, refer to the https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/zigbee/index.html#ug-zigbee and https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/zigbee/qsg.html 

    Kind regards,
    Andreas

     

Reply
  • Hi,

    "In a Zigbee network, how can the coordinator retrieve the list of all devices connected to the network?"

    An answer from our AI helper gives you some generic hints for how to do this

    To retrieve the list of all devices connected to a Zigbee network, the coordinator can use the Management LQI (Link Quality Indicator) request. This request allows the coordinator to obtain information about its neighboring devices, including their network addresses and other details. Here's how you can do this:

    1. Use the `zb_zdo_mgmt_lqi_req()` function to send a Management LQI request. This function is part of the ZBOSS Zigbee stack used in Nordic Semiconductor's Zigbee solutions.

    2. Set the destination address (`dst_addr`) parameter to the coordinator's own short address. This will retrieve the information about devices directly connected to the coordinator.

    3. Implement a callback function to handle the response from the Management LQI request. This callback will receive the information about the neighboring devices.

    To get a complete list of all devices in the network, you may need to send this request to each router in the network as well, as they might have additional devices connected to them.

    It's worth noting that executing this request frequently (e.g., every 3-5 seconds) might affect the Zigbee network performance, so it should be used judiciously.

    For more detailed information on using the Management LQI request and handling its response, you can refer to the https://developer.nordicsemi.com/nRF_Connect_SDK/doc/zboss/3.12.1.0/group__zdo__mgmt.html#ga231ec009bd8d5fffa218f30b9e5f089f

    What is the recommended way to maintain an up-to-date list of all devices in a Zigbee network using the nRF Connect SDK?

    You can for instance

    1. Use the Management LQI request periodically:
    As mentioned in the previous answer, you can use the `zb_zdo_mgmt_lqi_req()` function to retrieve information about neighboring devices. However, to get a complete picture of the network, you'll need to send this request to the coordinator and all routers in the network.

    2. Implement device join and leave callbacks:
    The nRF Connect SDK provides callbacks for device joining and leaving events. You can use these to keep your device list up-to-date in real-time.

    - For device joins, implement the `ZB_ZDO_SIGNAL_DEVICE_ANNCE` callback.
    - For device leaves, implement the `ZB_ZDO_SIGNAL_LEAVE` callback.

    3. Use the Zigbee Device Object (ZDO) callbacks:
    Implement the `ZB_ZCL_REGISTER_DEVICE_CB()` function to register callbacks for various Zigbee events, including device joins and leaves.

    Here's an example of how you might implement this:

    void zboss_signal_handler(zb_bufid_t bufid)
    {
        zb_zdo_app_signal_hdr_t *sg_p = NULL;
        zb_zdo_app_signal_type_t sig = zb_get_app_signal(bufid, &sg_p);
    
        switch (sig) {
            case ZB_ZDO_SIGNAL_DEVICE_ANNCE:
                // Handle new device join
                handle_device_join(sg_p);
                break;
            case ZB_ZDO_SIGNAL_LEAVE:
                // Handle device leave
                handle_device_leave(sg_p);
                break;
            // ... handle other signals as needed
        }
    
        if (bufid) {
            zb_buf_free(bufid);
        }
    }
    
    void device_cb(zb_bufid_t bufid)
    {
        zb_zcl_device_callback_param_t *device_cb_param =
            ZB_BUF_GET_PARAM(bufid, zb_zcl_device_callback_param_t);
    
        switch (device_cb_param->device_cb_id) {
            case ZB_ZCL_DEVICE_CB_ID_DEVICE_ANNCE:
                // Handle device announce
                break;
            case ZB_ZCL_DEVICE_CB_ID_LEAVE:
                // Handle device leave
                break;
            // ... handle other device callbacks as needed
        }
    }
    
    void main(void)
    {
        // ... other initialization code
    
        ZB_ZCL_REGISTER_DEVICE_CB(device_cb);
    
        // ... start Zigbee network
    }

    This approach allows you to maintain an up-to-date list of devices by:
    1. Periodically using the Management LQI request to get a full picture of the network.
    2. Updating the list in real-time as devices join or leave the network.

    Remember to handle the responses from the Management LQI requests and update your device list accordingly.

    For more detailed information on implementing these callbacks and handling Zigbee events, refer to the https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/zigbee/index.html#ug-zigbee and https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/protocols/zigbee/qsg.html 

    Kind regards,
    Andreas

     

Children
No Data
Related