Meshtastic Python CLI Guide
The python pip package installs a "meshtastic" command line executable, which displays packets sent over the network as JSON and lets you see serial debugging information from the meshtastic devices. This command is not run inside of python, you run it from your operating system shell prompt directly. If when you type "meshtastic" it doesn't find the command and you are using Windows: Check that the python "scripts" directory is in your path.
Optional Argumentsโ
-h or --helpโ
Shows a help message that describes the arguments.
meshtastic -h
--port PORTโ
The port the Meshtastic device is connected to, i.e. /dev/ttyUSB0
, /dev/cu.wchusbserial
, COM4
etc. if unspecified, meshtastic will try to find it. Important to use when multiple devices are connected to ensure you call the command for the correct device.
meshtastic --port /dev/ttyUSB0 --info
meshtastic --port COM4 --info
--host HOSTโ
The hostname/ipaddr of the device to connect to (over TCP).
meshtastic --host HOST
--seriallog SERIALLOGโ
Logs device serial output to either 'stdout', 'none' or a filename to append to.
meshtastic --port /dev/ttyUSB0 --seriallog
--infoโ
Read and display the radio config information.
meshtastic --port /dev/ttyUSB0 --info
--nodesโ
Prints a node list in a pretty, formatted table.
meshtastic --nodes
--qrโ
Displays the QR code that corresponds to the current channel.
meshtastic --qr
--get GETโ
Gets a preferences field.
meshtastic --get lora.region
--set [config_section].[option][value]โ
Sets a preferences field.
Configuration values are described in this section: Configuration Sections
meshtastic --set lora.region Unset
--seturl SETURLโ
Set a channel URL.
meshtastic --seturl https://www.meshtastic.org/c/GAMiIE67C6zsNmlWQ-KE1tKt0fRKFciHka-DShI6G7ElvGOiKgZzaGFyZWQ=
--ch-index CH_INDEXโ
Set the specified channel index
meshtastic --ch-index 1 --ch-disable
--ch-add CH_ADDโ
Add a secondary channel, you must specify a channel name.
meshtastic --ch-add testing-channel
--ch-delโ
Delete the ch-index channel.
meshtastic --ch-index 1 --ch-del
--ch-enableโ
Enable the specified channel.
meshtastic --ch-index 1 --ch-enable
--ch-disableโ
Disable the specified channel.
meshtastic --ch-index 1 --ch-disable
--ch-set CH_SET CH_SETโ
Set a channel parameter.
meshtastic --ch-set id 1234 --ch-index 0
--ch-longslowโ
Change to the standard long-range (but slow) channel.
meshtastic --ch-longslow
--ch-shortfastโ
Change to the standard fast (but short range) channel.
meshtastic --ch-shortfast
--set-owner SET_OWNERโ
Set device owner name.
meshtastic --dest '!28979058' --set-owner "MeshyJohn"
--set-ham SET_HAMโ
Set licensed Ham ID and turn off encryption.
meshtastic --set-ham KI1345
--dest DESTโ
The destination node id for any sent commands
meshtastic --dest '!28979058' --set-owner "MeshyJohn"
--sendtext SENDTEXTโ
Send a text message. Can specify a channel index ('--ch-index') or a destination ('--dest')
meshtastic --sendtext "Hello Mesh!"
--sendpingโ
Send a ping message (which requests a reply).
meshtastic --sendping
--rebootโ
Tell the destination node to reboot.
meshtastic --dest '!28979058' --reboot
--replyโ
Reply to received messages.
meshtastic --reply
--gpio-wrb GPIO_WRB GPIO_WRBโ
Set a particular GPIO # to 1 or 0.
meshtastic --port /dev/ttyUSB0 --gpio-wrb 4 1 --dest '!28979058'
--gpio-rd GPIO_RDโ
Read from a GPIO mask.
meshtastic --port /dev/ttyUSB0 --gpio-rd 0x10 --dest '!28979058'
--gpio-watch GPIO_WATCHโ
Start watching a GPIO mask for changes.
meshtastic --port /dev/ttyUSB0 --gpio-watch 0x10 --dest '!28979058'
--no-timeโ
Suppress sending the current time to the mesh.
meshtastic --port /dev/ttyUSB0 --no-time
--setalt SETALTโ
Set device altitude (allows use without GPS).
meshtastic --setalt 120
--setlat SETLATโ
Set device latitude (allows use without GPS).
meshtastic --setlat 25.2
--setlon SETLONโ
Set device longitude (allows use without GPS).
meshtastic --setlon -16.8
--debugโ
Show API library debug log messages.
meshtastic --debug --info
--testโ
Run stress test against all connected Meshtastic devices.
meshtastic --test
--ble BLEโ
BLE mac address to connect to (BLE is not yet supported for this tool).
meshtastic --ble "83:38:92:32:37:48"
--noprotoโ
Don't start the API, just function as a dumb serial terminal. Probably not very helpful from the command line. Used more for testing/internal needs.
meshtastic --noproto
--versionโ
Show program's version number and exit.
meshtastic --version
--configureโ
Configure all of the radio configuration from a yaml file.
meshtastic --configure example_config.yaml
--export-configโ
Export the configuration of the device. (to be consumed by the '--configure' command)
To create to a file with the connected device's configuration, this command's output must be piped to a yaml file
meshtastic --export-config > example_config.yaml
meshtastic --export-config
--supportโ
Print out info that would be helpful supporting any issues.
meshtastic --support
Deprecated Argumentsโ
--setchanโ
Deprecated - use "--ch-set param value" instead.
--set-routerโ
Deprecated - use "--set is_router true" instead.
--unset-routerโ
Deprecated - use "--set is_router false" instead.