2025-02-17 08:07 AM
We have a Zigbee network, working as a coordinator, and we want to know which devices are connected. In order to know which devices are connected, we use this code:
while (ZbNwkGetIndex(zigbee_app_info.zb, ZB_NWK_NIB_ID_NeighborTable, &neighbor, sizeof(neighbor), i++) == ZB_NWK_STATUS_SUCCESS)
{
if (neighbor.relationship == ZB_NWK_NEIGHBOR_REL_CHILD)
{
neigbors.device[neigbors.length].mac = neighbor.extAddr;
neigbors.device[neigbors.length].address = neighbor.nwkAddr;
neigbors.length++;
if (neigbors.length >= MAX_DEVICES)
break;
}
}
And in order to remove a device from the network, we use this code:
req.destAddr = device->address;
req.deviceAddr = device->mac;
req.flags = ZB_ZDO_MGMT_NWK_LEAVE_FLAG_REMOVE_CHILDREN;
status = ZbZdoLeaveReq(zigbee_app_info.zb, &req, NULL, NULL);
But several times, after remove a device, the device is still in the neighbor table.
What's wrong? We should handle the network in other ways? Which is the best way to know which devices are connected? And to remove a device?
Thank you!!
2025-02-17 08:23 AM
Devices that leave the network do not always disappear instantly from the neighbour table. You may need to wait for the entry to age out or explicitly trigger a table refresh.
2025-02-17 08:54 AM
Which is the best way to trigger a table refresh?
2025-02-19 11:20 AM
Hello @Joan Duran
This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.
Regards,
Roger