How to wait for and read ND response in Python?

Hi. I’m working on an IoT project at home, with the intention of having a dynamic network. As devices are added and removed from the network, the hub, the database of devices on the network is updated.

So, I intend to have each device broadcast it’s presence when it joins a network, no problem, but I also want the coordinator to periodically issue an ND to update the database of devices on the network.

My question is, how would I go about waiting for the response from all networked devices when I perform the ND?

This is probably a more generic question than this particular situation, but essentially, I need to figure out how I “wait” and read responses, and how to know when to stop waiting so I can carry on doing something else.

My first thought is that I would set a time-out and wait for that period for a response, from each of the devices, and reset the timer each time a device responds.

Is there a more concrete way for me to know when the responses have finished from the ND?

If it helps, I’m using python-xbee with the coordinator in API mode, and all routers/nodes are in transparent mode.


You can use getnode() from the following link,

Your response seems to indicate there is another Python library? I@m using this one:

The one you link doesn’t seem to have many of the features this one does and I’m not sure how it fits.