discover()
Use this function to perform a network discovery, which is equivalent to issuing the ND command. The timeout for the discovery is determined by the N? command.
xbee.discover()
This function accepts no parameters, and returns an iterator yielding a dictionary for each discovered node.
Note xbee.discover() returns immediately, but querying the resulting iterator will block execution until a response is available or the discovery times out (as determined by N?). See the xbee.discover() examples for more information.
Discovered node dictionaries can contain the following fields:
- sender_nwk: 16-bit network address
- sender_eui64: 8-byte bytes object with EUI-64 address
- parent_nwk: set to 0xFFFE on the coordinator and routers, otherwise the network address of the end device's parent
- node_id: the device's NI value (a string of up to 20 characters, also referred to as Node Identification)
- node_type: Value of 0, 1 or 2 for coordinator, router or end device.
- device_type: the device's 32-bit DD value (also referred to as Digi Device Type)
- rssi: RSSI of the node discovery request packet received by the sending node
Note Some of these fields may be excluded depending on what protocol the XBee device is running.
Example output on a Zigbee network:
{
'rssi': -20,
'node_id': ' ',
'device_type': 1179648,
'parent_nwk': 65534,
'sender_nwk': 41334,
'sender_eui64': b'\x00\x13\xa2\x00\x92w%`',
'node_type': 1
}
Example output on a 802.15.4 network:
{
'rssi': -20,
'node_id': ' ',
'sender_nwk': 41334,
'sender_eui64': b'\x00\x13\xa2\x00\x92w%`',
}
Example output on a DigiMesh network:
{
'rssi': -20,
'node_id': ' ',
'device_type': 1179648,
'sender_eui64': b'\x00\x13\xa2\x00\x92w%`',
'node_type': 1
}