A Python module that wraps the RF24Mesh C++ library’s API
- class pyrf24.rf24_mesh.RF24Mesh¶
Basic RF24Mesh API¶
- __init__(radio: RF24, network: RF24Network)¶
Create a RF24Mesh object.
begin(channel: int =
97, data_rate: rf24_datarate_e =
RF24_1MBPS, timeout: int =
7500) bool ¶
Trueif the radio’s hardware was properly initalized and the node successfully connected to the mesh network.
renew_address()in the event that the node becomes disconnected from the mesh network.
- update() int ¶
Keep the mesh network layer current. This function should be called regularly in the application. For applications that have a long-running operations in 1 “loop”/iteration, then it is advised to call this function more than once.
write(buf: bytes | bytearray, message_type: int, to_node_id: int =
0) bool ¶
- write(to_node_address: int, buf: bytes | bytearray, message_type: int) bool
Transmit a message to a unique
node_idof a mesh network node, use the following parameter:
When the network node’s Logical Address is already known, use the following parameter:
The instantiated RF24Mesh object’s unique identifying number. This value must range [0, 255].
renew_address(timeout: int =
7500) int ¶
Attempt to get a new Logical Address assigned from the mesh network’s master node.
If successful, this function returns the newly assigned Logical Address.
If unsuccessful, the returned integer will be the default address used by any node not connected to the mesh network. This default address is
Advanced RF24Mesh API¶
- check_connection() bool ¶
Check for connectivity with the mesh network.
renew_address()to reconnect to the mesh network.
The assigned Logical Address (in octal) given to the node by the mesh network’s master node.
- release_address() bool ¶
Use this function to manually expire a leased Logical Address from the mesh network’s master node.
This function allows re-use of the assigned address for other mesh network nodes. Call this function from mesh network nodes that are going offline (or to sleep).
get_node_id(address: int =
0xFFFF) int ¶
- get_address(node_id: int) int ¶
set_address(node_id: int, address: int, search_by_address: bool =
# Set a static address for node 0o2, with nodeID 23, since it will just be # a static routing node for example running on an ATTiny chip. mesh.setAddress(23, 0o2);
# Change or set the nodeID for an existing address address = 0o12; mesh.setAddress(3, address, True);
- node_id : int¶
The unique identifying number for the connected node.
- address : int¶
The Logical Address for the connected node.
- search_by_address : bool¶
- set_channel(channel: int)¶
This function controls the radio’s configured
- set_child(allow: bool)¶
Control the node’s ability to have child nodes connect to it.
The properties of this class are read-only because they can only be set by the master node upon successful connection to a child node.
- class pyrf24.rf24_mesh.AddrListStruct¶
These are the pre-defined constants provided for convenience and code readability.
A reserved valid address for use with RF24Mesh (when a mesh node requests an assigned address)
Reserved System Message Types¶
This is exclusively used by
This is exclusively used by