Integrations
Python and CLI automation
Script your mesh: the Meshtastic Python CLI and library, MeshCore's CLI and companion clients, and Reticulum's rnstatus, rnpath, rnprobe, rncp, rnx and rnsh.
- Difficulty
- Intermediate
- Time
- 45 min
- Cost
- Free (software); a Meshtastic, MeshCore or Reticulum setup you already run, and a computer with Python 3
Updated 27 Nov 2026
Overview
A phone app is the easy way to run a mesh node. A command line is the way to do it repeatably: set up ten nodes the same way, log what arrives, send an alert from a script, or check a Reticulum link from a server. This guide covers three separate tools, one per system:
| System | Tool | Where it runs |
|---|---|---|
| Meshtastic | meshtastic command and Python library |
On a computer connected to a node by USB, network or Bluetooth |
| MeshCore | The firmware's own command line (repeaters, room servers, sensors); meshcore-cli and the meshcore Python library, and meshcore.js, for companion radios |
On the node itself, over USB serial, or remotely over radio from the app; the clients run on a computer connected to a companion radio |
| Reticulum | rnstatus, rnpath, rnprobe, rncp, rnx, rnsh |
On any machine running Reticulum |
They do not interoperate. Each only works with its own network.
Versions this guide was read against, on 2026-11-04: Meshtastic stable firmware v2.7.26; the meshtastic Python package 2.7.11 (PyPI upload 17 July 2026, requires Python 3.9 or later and below 3.15); rns 1.5.7 on PyPI (5 October 2026); the Reticulum manual headed "1.5.5 documentation"; MeshCore docs from the main branch. MeshCore client packages, read on 2026-11-12: meshcore-cli 1.6.10 and meshcore 2.3.19 on PyPI (both uploaded 11 November 2026). The Meshtastic documentation pages carry a "Version: 2.8" header, and 2.8.x was a pre-release, so a flag documented there may not exist on stable. Run meshtastic --help on your own install to see what it accepts.
Meshtastic: install the CLI
The installation page lists prerequisites: serial drivers for the CP210X USB-to-UART bridge or, on some newer boards, the CH9102, plus Python 3 and pip. If your computer does not see the board, see flash Meshtastic and troubleshooting a LoRa mesh.
Command from the installation page (Linux and Windows tabs):
pip3 install --upgrade "meshtastic[cli]"
The page says the [cli] suffix "installs a few optional dependencies that match older versions of the CLI". On macOS the page uses pipx install "meshtastic[cli]". On Linux, if pip reports an externally-managed-environment error, the page gives this alternative:
sudo apt install pipx && pipx install "meshtastic[cli]"
If you use pipx, the page says you may need to run pipx ensurepath. The usage page notes that meshtastic is "a script run from your operating system shell prompt", not something you run inside Python; on Windows, if the command is not found, check that Python's scripts directory is on your path.
Termux on Android: the installation page says the CLI cannot control nodes over USB there, and that control over Wi-Fi with --host is "currently under development and may not be working properly just yet". Its Wi-Fi note covers ESP32 or Pico W only.
Connect
Three connection routes appear on the CLI page. These are its usage lines:
meshtastic --port /dev/ttyUSB0 --info
meshtastic --ble "device_name_or_address" --info
--port is for USB serial (the page says if you leave it out, the tool tries to find the device, and to specify it when several are connected). --host connects over TCP to a node's hostname or IP. The usage page warns that .local mDNS names often fail on Windows and in containers, and suggests the node's IP instead, for example meshtastic --host 192.168.1.50 --info. --ble needs a Bluetooth adapter; the first connection asks for the node's PIN, and on Linux you may need to pair with bluetoothctl first. meshtastic --ble-scan lists nearby nodes.
A node running meshtasticd on a Raspberry Pi is reached over the network, not Bluetooth; see a Raspberry Pi gateway with meshtasticd.
On Linux, a "Permission denied: /dev/ttyUSB0" error is a user-permission problem. The usage page's usual fix is:
sudo usermod -a -G dialout <username>
Read the node
meshtastic --info
meshtastic --nodes
meshtastic --get lora.region
--info reads and displays the radio configuration, --nodes prints the node list as a table, and --get reads a preference. The CLI page says that to see all valid values you can pass an invalid one such as 0; the usage page's equivalent example is meshtastic --get all. To save a node's whole configuration to a file and apply it to another node, the CLI page documents --export-config (output to a YAML file) and --configure. It also has --support, which prints information the page says would be helpful when asking for support.
Set the region and other settings
The CLI sets a preference with --set [config_section].[option] [value]. The CLI page's example is meshtastic --set lora.region Unset. For the UK the region is EU_868 (see flash Meshtastic); Meshtastic's LoRa page lists EU_868 as an accepted value. No documentation code block we read shows the exact command with EU_868, so we do not paste one: use the pattern above and read the setting back with --get lora.region.
Two version-sensitive points from the documentation:
- Whether the node reboots after a
--setdepends on the section and on which version of the docs you read; Meshtastic's own pages disagree. As read 21 November 2026, the 2.8 LoRa configuration page says "LoRa settings apply without a reboot." and still says to chain several values in one command, with the examplemeshtastic --set lora.region US --set lora.modem_preset LONG_FAST. The "2.7 and below" LoRa page, and the 2.8 telemetry page, instead say "Because the device will reboot after each command is sent via CLI, it is recommended when setting multiple values in a config section that commands be chained together as one." So for LoRa settings follow the 2.8 wording only if your node runs a firmware that matches that doc set; for other sections plan for one reboot per command and chain your--setoptions. We did not test either on hardware. The CLI page also has--wait-to-disconnect, because, per the page, some devices reboot when the serial connection disconnects. - Setting names have moved between releases. Check the name with
--geton your own firmware before putting it in a script. The telemetry guide lists the telemetry keys the docs give.
Channels
Commands from the usage and CLI pages:
meshtastic --ch-set name mychan --ch-index 1 --info
meshtastic --ch-add testing-channel
meshtastic --ch-index 1 --ch-del
The usage page says all --ch-set commands need the --ch-index parameter. The CLI page marks --ch-enable and --ch-disable as deprecated, with --ch-add and --ch-del preferred. The key options on the usage page include --ch-set psk none, --ch-set psk random and --ch-set psk default; the page calls the default key "minimally secure, because it is in the source code for anyone to read". --seturl replaces your current configuration and channels completely, per the CLI page.
--set-ham is documented as setting a licensed ham ID and turning off encryption on the primary channel. It is for licensed amateur use only; see the UK amateur radio licence path. Undo it with --set-owner, --set-owner-short and --seturl or --ch-set, or --factory-reset, per the CLI page.
Send messages
meshtastic --sendtext 'Hello Mesh!'
meshtastic --ch-index 1 --sendtext 'Hello secondary channel!'
meshtastic --sendtext 'Hello Mesh!' --dest '!28979058' --ack
These are the CLI page's examples. --ch-index picks the channel, --dest a destination node, and --ack waits for an acknowledgement, which the page says not every command can return; it suggests using it for commands that specify a single destination node. The page warns that many shells treat ! specially, so put node IDs in single quotes.
--dest is also how the CLI does remote node administration. That depends on the remote admin setup described in channels, keys and private groups.
Two options listen rather than send. --listen stays open and prints protocol-buffer messages (and enables --debug). --reply listens and, on each message received, sends a message back to the primary channel that repeats it. A reply to every received message is automatic transmission; do not leave it running on a busy channel.
meshtastic --request-telemetry --dest '!ba4bf9d0' asks a node for its telemetry; meshtastic --traceroute '!ba4bf9d0' traces a path to it. The IDs are the CLI page's examples.
The Python library and event callbacks
The same package is a library. The installation page says it provides "an easy API for sending and receiving messages over mesh radios. Events are delivered using a publish-subscribe model, and you can subscribe to only the message types you are interested in." The package depends on pypubsub (PyPI metadata), which is where from pubsub import pub comes from.
The library documentation names three primary interfaces: SerialInterface, TCPInterface and BLEInterface. It lists these topics:
| Topic | Published when |
|---|---|
meshtastic.connection.established |
The library has connected and downloaded the node database |
meshtastic.connection.lost |
The link to the radio is lost |
meshtastic.receive |
Any packet arrives (subscribe to this to see all packets) |
meshtastic.receive.text(packet) |
A text packet arrives, delivered as a dictionary |
meshtastic.receive.position(packet) and meshtastic.receive.user(packet) |
Position and user packets |
meshtastic.receive.data.portnum(packet) |
A data packet for a port number |
meshtastic.node.updated(node = NodeInfo) |
A node in the database changes |
meshtastic.log.line(line) |
A raw log line from the radio |
The documentation's own example, copied from the library API page:
import meshtastic
import meshtastic.serial_interface
from pubsub import pub
def onReceive(packet, interface): # called when a packet arrives
print(f"Received: {packet}")
def onConnection(interface, topic=pub.AUTO_TOPIC): # called when we (re)connect to the radio
# defaults to broadcast, specify a destination ID if you wish
interface.sendText("hello mesh")
pub.subscribe(onReceive, "meshtastic.receive")
pub.subscribe(onConnection, "meshtastic.connection.established")
# By default will try to find a meshtastic device, otherwise provide a device path like /dev/ttyUSB0
interface = meshtastic.serial_interface.SerialInterface()
We did not run this. Notes on it:
- The page does not state which library version it describes.
onConnectionbroadcasts "hello mesh" every time the library connects or reconnects. That is a transmission on your mesh each time. Replace it with something you want sent, or remove it.- The example ends after creating the interface. A script that must keep receiving has to stay running; the page does not show how.
- The page says
decoded.data.textis also filled for packets sent withsendText. For the exact fields of a telemetry packet, print one; the page does not list them. - The page also describes
nodes(the node database, read-only) andlocalNode.
The project's own README is candid. It says the library and CLI "has gone without a consistent maintainer for a while", and its roadmap lists "there should be a consistent output format available for shell scripting" and "pubsub events should be documented clearly" as things still to do. So parse CLI text output with caution, and pin the package version in anything you depend on. The GitHub repository was last pushed to on 30 October 2026 and released 2.7.11 on 17 July 2026 (read 2026-11-04).
The README also documents a container image: docker run --rm ghcr.io/meshtastic/python --help. It says to pass the serial device through explicitly when talking to local hardware.
MeshCore: the firmware command line
MeshCore has two kinds of command-line surface. This section starts with the firmware command reference for repeaters, room servers and sensors; the companion clients subsection after it covers the programs that run on a computer and talk to a companion radio. The reference's cli_commands.md is described in its first line as "an overview of CLI commands that can be sent to MeshCore Repeaters, Room Servers and Sensors". It is a command line on the node, not a program you install on a computer.
How to reach it, per the MeshCore FAQ: connect a server device (repeater or room server) by USB to a computer running Chrome, open the web flasher at flasher.meshcore.io, and use its console feature. The FAQ also says a repeater or room server can be administered remotely over radio, from a T-Deck with remote administration unlocked or from the smartphone app. Some commands are marked "Serial Only: Yes" in the reference.
Commands the reference documents (read from the main branch on 2026-11-04):
| Command | What it does, per the reference |
|---|---|
ver |
Gets the version |
board |
Shows the hardware name |
get radio and set radio <freq>,<bw>,<sf>,<cr> |
Views or changes radio parameters; "Requires reboot to apply" |
get tx and set tx <dbm> |
Views or changes transmit power in dBm (1-22 range) |
get dutycycle and set dutycycle <value> |
Duty cycle percentage, default 50%; added in firmware v1.15.0 |
advert |
Sends a flood advert |
stats-radio |
Noise floor, last RSSI/SNR, airtime, receive errors; serial only |
sensor list [start], sensor get <key>, sensor set <key> <value> |
Sensor settings, "When sensor support is compiled in" |
erase |
Factory reset; serial only, and the reference warns it is destructive |
Version caution: the reference marks features by firmware version (for example dutycycle from v1.15.0, and the older af airtime-factor command as deprecated from the same version), so the command set on your node depends on the firmware you flashed. The reference's default radio parameters (869.618,62.5,8,5) differ from the app's EU/UK (Narrow) preset in coding rate; see flash MeshCore before you set radio values by hand. For the repeater duty-cycle point, see MeshCore repeater vs Meshtastic router. The reference says for set tx: "Setting a value too high may violate the laws in your country."
MeshCore companion clients
MeshCore's README (read 2026-11-12) says "The companion firmware can be connected to via BLE, USB or Wi-Fi depending on the firmware type you flashed", and lists a NodeJS client (meshcore.js) and a Python one (meshcore-cli). These are different from the firmware command line above: they run on your computer and talk to a companion radio. The meshcore-cli, meshcore and MeshCore READMEs and the PyPI pages were re-read on 2026-11-12; the meshcore.js and npm details are as read on 2026-11-10. Each README is summarised below. We did not run any of the commands.
meshcore-cli. Its README opens, under the title, with the line "meshcore-cli : CLI interface to MeshCore companion app over BLE, TCP or Serial" and says it "connects to your companion radio node (meshcore client) over BLE, TCP or Serial". The README also says "most meshcore companions only have one interface compiled in at a time", so you cannot connect over serial to a node compiled as a BLE companion. The version read was 1.6.10, uploaded to PyPI on 11 November 2026 (read 2026-11-12); its metadata says Python 3.10 or later. The repository has moved: GitHub now redirects github.com/fdlamotte/meshcore-cli to github.com/meshcore-dev/meshcore-cli, although MeshCore's README link and the PyPI project metadata still use the old address. The README's install command:
pipx install meshcore-cli
The README says this installs meshcore-cli and meshcli, "which is an alias to the former", and that the package depends on the Python meshcore library below. Connection options from its argument list: -a <address> (an address or a name), -t <hostname> for TCP (with -p <port>, default 5000), -s <port> for a serial port with -b <baudrate>, and -S to scan for BLE devices and choose one. For BLE it says to pair the device first, for example with bluetoothctl on Linux. Example commands copied from its Examples section (the README shows them after a $ prompt, with node names and BLE addresses from the author's own nodes):
meshcore-cli -d "" infos
meshcli -a C2:2B:A1:D5:3E:B6 clock
meshcli msg Techo_fdl "Hello T-Echo" wa
meshcli -d Techo sm
meshcli -j -a C2:2B:A1:D5:3E:B6 clock
meshcli -j clock clock sync clock | jq -c
Per the README, the first gets information from the first BLE device it finds, and prints it as JSON including radio_freq, radio_bw and radio_sf. msg <name> <msg> sends a message to a contact and wa is the short form of wait_ack; the README's output is Msg acked. sm is short for sync_msgs ("gets all unread msgs from the node"). -j gives JSON output, and a command prefixed with a dot gives the same. The command list also has contacts or list ("gets contact list"), chan <nb> <msg> ("send message to channel number") and public <msg> ("send message to public channel (0)"). Run with no command, meshcli starts an interactive chat mode. A -r option is for a repeater running the firmware's own command line, not a companion radio. The README says "A serial repeater mode has been introduced, which is triggered using -r, which mainly adds line editing, history and completion to the serial interface, adds time syncing through clock sync and let you download/upload regions specs from a file". The usage text in the program source (meshcore_cli.py on the main branch, read 21 November 2026) lists it as "-r : repeater mode (raw text CLI, use with -s)", and the same source stops with "Repeater mode (-r) requires serial port (-s)" if no serial port is given. So it is used together with -s <port>; the README's own argument list does not mention -r. We did not run it. In the examples, -d <name> is described in the README's argument list as "filter meshcore devices with name or address"; -d "" is the README's own "first ble MC device it finds" example, and -d Techo filters on the name "Techo".
meshcore Python library. PyPI meshcore 2.3.19, uploaded 11 November 2026 (read 2026-11-12), is described in the project's README as "Python library for interacting with MeshCore companion radio nodes", for Python 3.10 or later. Its repository is meshcore-dev/meshcore_py; the PyPI metadata still names the old address github.com/fdlamotte/meshcore_py, which GitHub now redirects there. Its install line is pip install meshcore. Its README gives these connection calls (inside asyncio code), which match the same three routes:
meshcore = await MeshCore.create_serial("/dev/ttyUSB0", 115200, debug=True)
meshcore = await MeshCore.create_ble("12:34:56:78:90:AB")
meshcore = await MeshCore.create_tcp("192.168.1.100", 4000)
Its Quick Start continues with meshcore.commands.get_contacts() and meshcore.commands.send_msg(contact, "Hello from Python!"). We do not paste the whole example; read it in the README.
meshcore.js. The link in MeshCore's README is github.com/liamcottle/meshcore.js, which redirects to meshcore-dev/meshcore.js. Its README calls it "a JavaScript library for interacting with a MeshCore device running the Companion Radio Firmware". In a web browser it connects over BLE or USB serial; in Node.js, over TCP/Wi-Fi or USB serial. Install line from the README:
npm install @liamcottle/meshcore.js
The README's example uses NodeJSSerialConnection with a comment that serial connections are supported by "companion_radio_usb" firmware, and TCPConnection for "companion_radio_wifi" firmware. The npm registry listed @liamcottle/meshcore.js 1.15.0, published 19 August 2026; the repository was last pushed to on 4 October 2026 (GitHub API, read 2026-11-10).
Commands that send over the radio, such as msg, chan and public, are transmissions, so the rules of thumb in In the UK apply to them as they do to --sendtext.
Reticulum: command-line tools
Reticulum's tools come with the rns package. The deprecated standalone rnsh package page says to install rnsh by running pip install rns (1.3.9 or later) and that "the rnsh command is included". The Reticulum manual describes each tool; the quotes and examples below are from its "using Reticulum" page (documentation 1.5.5, read 2026-11-04). The hexadecimal hashes in its examples are placeholders from the manual, not real destinations.
pip install rns
| Tool | Purpose, per the manual | Example from the manual |
|---|---|---|
rnstatus |
"view the status of and control configured Reticulum interfaces, similar to the ifconfig program" | rnstatus; the usage text lists -j, --json for JSON output and -d for discovered interfaces |
rnpath |
"look up and view paths for destinations on the Reticulum network" | rnpath c89b4da064bf66d280f0e4d8abfd9806; usage lists -t, --table to show all known paths |
rnprobe |
"probe a destination for connectivity, similar to the ping program" | rnprobe rnstransport.probe 2d03725b327348980d570f739a3a5708 |
rncp |
"a simple file transfer tool" | rncp --listen; rncp ~/path/to/file.tgz 73cbd378bb0286ed11a707c13447bb1e |
rnx |
"a basic remote command execution program" | rnx --listen -a 941bed5e228775e5a8079fc38b1ccf3f; rnx 7a55144adf826958a9529a3bcf08b149 "cat /proc/cpuinfo" |
rnsh |
"a fully interactive remote shell over Reticulum" | rnsh -l; rnsh 7a55144adf826958a9529a3bcf08b149 |
Points the manual makes that matter:
rnprobeoften gets no answer. The manual says "probes will only be answered if the specified destination is configured to send proofs for received packets. Many destinations will not have this option enabled, so most destinations will not be probable." A transport instance can enable a probe reply with therespond_to_probesconfiguration directive.rncpfetch.rncp --fetch ~/path/to/file.tgz 73cbd378bb0286ed11a707c13447bb1efetches a file from a remote listener; the usage text lists-F, --allow-fetch("allow authenticated clients to fetch files"). Allowed identities can go in~/.rncp/allowed_identities.rncp,rnxandrnshneed an allow-list. Use-a <identity hash>or the allowed-identities file. All three have an option that accepts anyone (rncp -n/--no-auth,rnx -n/--noauth,rnsh -l -n). The manual's warning for rnsh is plain: "any Reticulum peer that can reach your listener will be able to execute commands on your system." Do not use it on a machine you care about.rnshis bundled. The standalonepip install rnshpackage (final release 0.1.8, 27 October 2026) is marked deprecated on PyPI. The Reticulum README still links the old repository in one sentence, so two official texts disagree; we do not send you there. Because both packages provide anrnshcommand, installing the old one next tornscould replace the other; we did not test it.- Over LoRa. The Reticulum README says "All tools, including
rnxandrncp, work reliably and well even over very low-bandwidth links like LoRa or Packet Radio." LoRa speeds are in kilobits a second at best, so a file transfer holds the channel for a long time. See set up an RNode with Reticulum.
Also in rns: rnodeconf for inspecting and configuring RNodes (its -i option is --info) and rnid for identities. The package installs further commands (including rngit) that we have not covered.
Writing your own program against LXMF (Reticulum's message layer) needs a basic grasp of Reticulum's API. The LXMF README points to a sender example and a receiver example in its docs folder; read example_sender.py rather than a snippet pasted here, which would be incomplete without the destination setup. The Reticulum README labels its repository a public mirror.
In the UK
A script that sends is you transmitting. Nothing about automation changes the limits; it only makes it easy to exceed them.
Rules of thumb for scripts:
- Rate-limit anything that sends. Do not put
--sendtext,--request-telemetry,--tracerouteorrnprobein a fast loop. --replyand anonConnectionhandler that sends are both automatic transmissions. Check what they do after a reconnect.- Prefer reading to sending. Listening costs no airtime.
What we could not confirm
- The exact
meshtastic --set lora.region EU_868command as a documentation code block. We describe the pattern instead. - Which flags exist only on the 2.8 pre-release docs. The Meshtastic pages carry a "Version: 2.8" header and do not mark individual flags.
- A documented list of telemetry fields in a received packet, and a telemetry-specific pubsub topic. The library page lists neither.
- The library version the API page describes, and whether the documented example still runs unchanged. We did not run it.
- How meshcore-cli, the
meshcorelibrary andmeshcore.jsbehave when run. We read their READMEs and package metadata on 2026-11-12 (meshcore.jsand npm on 2026-11-10) and ran nothing; the meshcore-cli examples are the README's own output from the author's nodes. We did not read the other example scripts in the repositories, nor how the-rrepeater mode behaves beyond the README's description and the program's usage text and start-up check. - Whether MeshCore companion radios accept every command in the reference. Its scope line names repeaters, room servers and sensors.
- Whether
rnshbundled inrnsbehaves identically to the old standalone 0.1.8. We read the manual, and did not install either. - What
rnirandrnpkg, two other commands thernspackage installs, do. The manual's utilities page does not describe them. - A supported way to get machine-readable output from every Meshtastic CLI command. The project's roadmap lists it as unfinished.
Sources
- Meshtastic: Python CLI
- Meshtastic: Python CLI installation
- Meshtastic: using the Python CLI
- Meshtastic Python library API documentation
- GitHub: meshtastic/python
- PyPI: meshtastic
- Meshtastic: telemetry module configuration
- Meshtastic: getting started (antenna warning)
- MeshCore CLI commands
- MeshCore FAQ
- MeshCore on GitHub (README lists the Python and NodeJS clients)
- PyPI: meshcore-cli
- PyPI: meshcore
- GitHub: meshcore-dev/meshcore-cli (README; moved from fdlamotte/meshcore-cli)
- GitHub: meshcore-dev/meshcore_py (README; moved from fdlamotte/meshcore_py)
- GitHub: meshcore-dev/meshcore-cli (source, usage text for -r)
- GitHub: meshcore.js (README)
- npm registry: @liamcottle/meshcore.js
- Reticulum manual: using Reticulum (utilities)
- GitHub: markqvist/Reticulum (README, public mirror)
- PyPI: rns
- PyPI: rnsh (deprecated standalone package)
- GitHub: markqvist/LXMF (README, public mirror)
- Ofcom IR 2030 v1.17 (published 23 October 2026)