digi.xbee.models.zdo package

class digi.xbee.models.zdo.NodeDescriptorReader(xbee, configure_ao=True, timeout=20)[source]

Bases: digi.xbee.models.zdo._ZDOCommand

This class performs a node descriptor read of the given XBee using a ZDO command.

The node descriptor read works only with Zigbee devices in API mode.

Class constructor. Instantiates a new NodeDescriptorReader object with the provided parameters.

Parameters
  • (class (xbee) – .XBeeDevice or class:.RemoteXBeeDevice): XBee to send the command.

  • configure_ao (Boolean, optional, default=`True`) – True to set AO value before and after executing, False otherwise.

  • timeout (Float, optional, default=`.__DEFAULT_TIMEOUT`) – The ZDO command timeout in seconds.

Raises
  • ValueError – If xbee is None.

  • ValueError – If cluster_id, receive_cluster_id, or timeout are less than 0.

  • TypeError – If the xbee is not a .XBeeDevice or a RemoteXBeeDevice.

get_node_descriptor()[source]

Returns the descriptor of the node.

Returns

The node descriptor.

Return type

NodeDescriptor

property error

Returns the error string if any.

Returns

The error string.

Return type

String

property running

Returns if this ZDO command is running.

Returns

True if it is running, False otherwise.

Return type

Boolean

stop()

Stops the ZDO command process if it is running.

class digi.xbee.models.zdo.NodeDescriptor(role, complex_desc_supported, user_desc_supported, freq_band, mac_capabilities, manufacturer_code, max_buffer_size, max_in_transfer_size, max_out_transfer_size, desc_capabilities)[source]

Bases: object

This class represents a node descriptor of an XBee.

Class constructor. Instantiates a new NodeDescriptor object with the provided parameters.

Parameters
  • role (Role) – The device role.

  • complex_desc_supported (Boolean) – True if the complex descriptor is supported.

  • user_desc_supported (Boolean) – True if the user descriptor is supported.

  • freq_band (List) – Byte array with the frequency bands.

  • mac_capabilities (List) – Byte array with MAC capabilities.

  • manufacturer_code (Integer) – The manufacturer’s code assigned by the Zigbee Alliance.

  • max_buffer_size (Integer) – Maximum size in bytes of a data transmission.

  • max_in_transfer_size (Integer) – Maximum number of bytes that can be received by the node.

  • max_out_transfer_size (Integer) – Maximum number of bytes that can be transmitted by the node.

  • desc_capabilities (List) – Byte array with descriptor capabilities.

property role

Gets the role in this node descriptor.

Returns

The role of the node descriptor.

Return type

Role

See also

property complex_desc_supported

Gets if the complex descriptor is supported.

Returns

True if supported, False otherwise.

Return type

Boolean

property user_desc_supported

Gets if the user descriptor is supported.

Returns

True if supported, False otherwise.

Return type

Boolean

property freq_band

Gets the frequency bands (LSB - bit0- index 0, MSB - bit4 - index 4): * Bit0: 868 MHz * Bit1: Reserved * Bit2: 900 MHz * Bit3: 2.4 GHz * Bit4: Reserved

Returns

List of integers with the frequency bands bits.

Return type

List

property mac_capabilities

Gets the MAC capabilities (LSB - bit0- index 0, MSB - bit7 - index 7): * Bit0: Alternate PAN coordinator * Bit1: Device Type * Bit2: Power source * Bit3: Receiver on when idle * Bit4-5: Reserved * Bit6: Security capability * Bit7: Allocate address

Returns

List of integers with MAC capabilities bits.

Return type

List

property manufacturer_code

Gets the manufacturer’s code assigned by the Zigbee Alliance.

Returns

The manufacturer’s code.

Return type

Integer

property max_buffer_size

Gets the maximum size in bytes of a data transmission (including APS bytes).

Returns

Maximum size in bytes.

Return type

Integer

property max_in_transfer_size

Gets the maximum number of bytes that can be received by the node.

Returns

Maximum number of bytes that can be received by the node.

Return type

Integer

property max_out_transfer_size

Gets the maximum number of bytes that can be transmitted by the node, including fragmentation.

Returns

Maximum number of bytes that can be transmitted by the node.

Return type

Integer

property desc_capabilities

Gets the descriptor capabilities (LSB - bit0- index 0, MSB - bit1 - index 1): * Bit0: Extended active endpoint list available * Bit1: Extended simple descriptor list available

Returns

List of integers with descriptor capabilities bits.

Return type

List

class digi.xbee.models.zdo.RouteTableReader(xbee, configure_ao=True, timeout=20)[source]

Bases: digi.xbee.models.zdo._ZDOCommand

This class performs a route table read of the given XBee using a ZDO command.

The node descriptor read works only with Zigbee devices in API mode.

Class constructor. Instantiates a new RouteTableReader object with the provided parameters.

Parameters
  • (class (xbee) – .XBeeDevice or class:.RemoteXBeeDevice): XBee to send the command.

  • configure_ao (Boolean, optional, default=`True`) – True to set AO value before and after executing, False otherwise.

  • timeout (Float, optional, default=`.DEFAULT_TIMEOUT`) – The ZDO command timeout in seconds.

Raises
  • ValueError – If xbee is None.

  • ValueError – If cluster_id, receive_cluster_id, or timeout are less than 0.

  • TypeError – If the xbee is not a .XBeeDevice or a .RemoteXBeeDevice.

get_route_table(route_cb=None, finished_cb=None)[source]

Returns the routes of the XBee. If route_cb is not defined, the process blocks until the complete routing table is read.

Parameters
  • route_cb (Function, optional, default=`None`) –

    Method called when a new route is received. Receives two arguments:

    • The XBee that owns this new route.

    • The new route.

  • finished_cb (Function, optional, default=`None`) –

    Method to execute when the process finishes. Receives three arguments:

    • The XBee that executed the ZDO command.

    • A list with the discovered routes.

    • An error message if something went wrong.

Returns

List of Route when route_cb is not defined,

None otherwise (in this case routes are received in the callback).

Return type

List

See also

property error

Returns the error string if any.

Returns

The error string.

Return type

String

property running

Returns if this ZDO command is running.

Returns

True if it is running, False otherwise.

Return type

Boolean

stop()

Stops the ZDO command process if it is running.

class digi.xbee.models.zdo.RouteStatus(value)[source]

Bases: enum.Enum

Enumerates the available route status.

property id

Returns the identifier of the RouteStatus.

Returns

RouteStatus identifier.

Return type

Integer

classmethod get(identifier)[source]

Returns the RouteStatus for the given identifier.

Parameters

identifier (Integer) – Id corresponding to the route status to get.

Returns

RouteStatus with the given id. None if

it does not exist.

Return type

RouteStatus

class digi.xbee.models.zdo.Route(destination, next_hop, status, is_low_memory, is_many_to_one, is_route_record_required)[source]

Bases: object

This class represents a Zigbee route read from the route table of an XBee.

Class constructor. Instantiates a new Route object with the provided parameters.

Parameters
  • destination (XBee16BitAddress) – 16-bit destination address of the route.

  • next_hop (XBee16BitAddress) – 16-bit address of the next hop.

  • status (RouteStatus) – Status of the route.

  • is_low_memory (Boolean) – True to indicate if the device is a low-memory concentrator.

  • is_many_to_one (Boolean) – True to indicate the destination is a concentrator.

  • is_route_record_required (Boolean) – True to indicate a route record message should be sent prior to the next data transmission.

property destination

Gets the 16-bit address of this route destination.

Returns

16-bit address of the destination.

Return type

XBee16BitAddress

See also

property next_hop

Gets the 16-bit address of this route next hop.

Returns

16-bit address of the next hop.

Return type

XBee16BitAddress

See also

property status

Gets this route status.

Returns

The route status.

Return type

RouteStatus

See also

property is_low_memory

Gets whether the device is a low-memory concentrator.

Returns

True if the device is a low-memory concentrator, False otherwise.

Return type

Boolean

property is_many_to_one

Gets whether the destination is a concentrator.

Returns

True if destination is a concentrator, False otherwise.

Return type

Boolean

property is_route_record_required

Gets whether a route record message should be sent prior the next data transmission.

Returns

True if a route record message should be sent, False otherwise.

Return type

Boolean

class digi.xbee.models.zdo.NeighborTableReader(xbee, configure_ao=True, timeout=20)[source]

Bases: digi.xbee.models.zdo._ZDOCommand

This class performs a neighbor table read of the given XBee using a ZDO command.

The node descriptor read works only with Zigbee devices in API mode.

Class constructor. Instantiates a new NeighborTableReader object with the provided parameters.

Parameters
  • (class (xbee) – .XBeeDevice or class:.RemoteXBeeDevice): XBee to send the command.

  • configure_ao (Boolean, optional, default=`True`) – True to set AO value before and after executing, False otherwise.

  • timeout (Float, optional, default=`.DEFAULT_TIMEOUT`) – The ZDO command timeout in seconds.

Raises
  • ValueError – If xbee is None.

  • ValueError – If cluster_id, receive_cluster_id, or timeout are less than 0.

  • TypeError – If the xbee is not a .XBeeDevice or a .RemoteXBeeDevice.

get_neighbor_table(neighbor_cb=None, finished_cb=None)[source]

Returns the neighbors of the XBee. If neighbor_cb is not defined, the process blocks until the complete neighbor table is read.

Parameters
  • neighbor_cb (Function, optional, default=`None`) –

    Method called when a new neighbor is received. Receives two arguments:

    • The XBee that owns this new neighbor.

    • The new neighbor.

  • finished_cb (Function, optional, default=`None`) –

    Method to execute when the process finishes. Receives three arguments:

    • The XBee that executed the ZDO command.

    • A list with the discovered neighbors.

    • An error message if something went wrong.

Returns

List of Neighbor when neighbor_cb is not defined,

None otherwise (in this case neighbors are received in the callback)

Return type

List

See also

property error

Returns the error string if any.

Returns

The error string.

Return type

String

property running

Returns if this ZDO command is running.

Returns

True if it is running, False otherwise.

Return type

Boolean

stop()

Stops the ZDO command process if it is running.

class digi.xbee.models.zdo.NeighborRelationship(value)[source]

Bases: enum.Enum

Enumerates the available relationships between two nodes of the same network.

property id

Returns the identifier of the NeighborRelationship.

Returns

NeighborRelationship identifier.

Return type

Integer

classmethod get(identifier)[source]

Returns the NeighborRelationship for the given identifier.

Parameters

identifier (Integer) – Id corresponding to the neighbor relationship to get.

Returns

the NeighborRelationship with the

given id. None if it does not exist.

Return type

NeighborRelationship

class digi.xbee.models.zdo.Neighbor(node, relationship, depth, lq)[source]

Bases: object

This class represents a Zigbee or DigiMesh neighbor.

This information is read from the neighbor table of a Zigbee XBee, or provided by the ‘FN’ command in a Digimesh XBee.

Class constructor. Instantiates a new Neighbor object with the provided parameters.

Parameters
  • node (RemoteXBeeDevice) – The neighbor node.

  • relationship (NeighborRelationship) – The relationship of this neighbor with the node.

  • depth (Integer) – The tree depth of the neighbor. A value of 0 indicates the device is a Zigbee coordinator for the network. -1 means this is unknown.

  • lq (Integer) – The estimated link quality (LQI or RSSI) of data transmission from this neighbor.

property node

Gets the neighbor node.

Returns

The node itself.

Return type

RemoteXBeeDevice

See also

property relationship

Gets the neighbor node.

Returns

The neighbor relationship.

Return type

NeighborRelationship

property depth

Gets the tree depth of the neighbor.

Returns

The tree depth of the neighbor.

Return type

Integer

property lq

Gets the estimated link quality (LQI or RSSI) of data transmission from this neighbor.

Returns

The estimated link quality of data transmission from this neighbor.

Return type

Integer

class digi.xbee.models.zdo.NeighborFinder(xbee, timeout=20)[source]

Bases: object

This class performs a find neighbors (FN) of an XBee. This action requires an XBee and optionally a find timeout.

The process works only in DigiMesh.

Class constructor. Instantiates a new NeighborFinder object with the provided parameters.

Parameters
  • (class (xbee) – .XBeeDevice or class:.RemoteXBeeDevice): The XBee to get neighbors from.

  • timeout (Float) – The timeout for the process in seconds.

Raises
  • OperationNotSupportedException – If the process is not supported in the XBee.

  • TypeError – If the xbee is not a .AbstractXBeeDevice.

  • ValueError – If xbee is None.

  • ValueError – If timeout is less than 0.

property running

Returns whether this find neighbors process is running.

Returns

True if it is running, False otherwise.

Return type

Boolean

property error

Returns the error string if any.

Returns

The error string.

Return type

String

stop()[source]

Stops the find neighbors process if it is running.

get_neighbors(neighbor_cb=None, finished_cb=None)[source]

Returns the neighbors of the XBee. If neighbor_cb is not defined, the process blocks until the complete neighbor table is read.

Parameters
  • neighbor_cb (Function, optional, default=`None`) –

    Method called when a new neighbor is received. Receives two arguments:

    • The XBee that owns this new neighbor.

    • The new neighbor.

  • finished_cb (Function, optional, default=`None`) –

    Method to execute when the process finishes. Receives three arguments:

    • The XBee that executed the FN command.

    • A list with the discovered neighbors.

    • An error message if something went wrong.

Returns

List of Neighbor when neighbor_cb is not defined,

None otherwise (in this case neighbors are received in the callback)

Return type

List

See also