meshtastic/docs/software/python/cli.md

6.1 KiB

id title sidebar_label
python-cli meshtastic command line interface guide meshtastic cli

Meshtastic 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.

Usage

meshtastic -h

--port PORT

The port the Meshtastic device is connected to, i.e. /dev/ttyUSB0 or COM4. 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.

Usage

meshtastic --port /dev/ttyUSB0 --info
meshtastic --port COM4 --info

--host HOST

The hostname/ipaddr of the device to connect to (over TCP).

Usage

meshtastic --host HOST

--seriallog SERIALLOG

Logs device serial output to either 'stdout', 'none' or a filename to append to.

Usage

meshtastic --port /dev/ttyUSB0 --seriallog

--info

Read and display the radio config information.

Usage

meshtastic --port /dev/ttyUSB0 --info

--nodes

Prints a node list in a pretty, formatted table.

Usage

meshtastic --nodes

--qr

Displays the QR code that corresponds to the current channel.

Usage

meshtastic --qr

--get GET

Gets a preferences field.

Usage

meshtastic --get modem_config

--set SET SET

Sets a preferences field.

Usage

meshtastic --set region Unset

--seturl SETURL

Set a channel URL.

Usage

meshtastic --seturl https://www.meshtastic.org/c/GAMiIE67C6zsNmlWQ-KE1tKt0fRKFciHka-DShI6G7ElvGOiKgZzaGFyZWQ=

--ch-index CH_INDEX

Set the specified channel index

Usage

meshtastic --ch-index 1 --ch-disable

--ch-add CH_ADD

Add a secondary channel, you must specify a channel name.

Usage

meshtastic --ch-add testing-channel

--ch-del

Delete the ch-index channel.

Usage

meshtastic --ch-index 1 --ch-del

--ch-enable

Enable the specified channel.

Usage

meshtastic --ch-index 1 --ch-enable

--ch-disable

Disable the specified channel.

Usage

meshtastic --ch-index 1 --ch-disable

--ch-set CH_SET CH_SET

Set a channel parameter.

Usage

meshtastic --ch-set id 1234 --ch-index 0

--ch-longslow

Change to the standard long-range (but slow) channel.

Usage

meshtastic --ch-longslow

--ch-shortfast

Change to the standard fast (but short range) channel.

Usage

meshtastic --ch-shortfast

--set-owner SET_OWNER

Set device owner name.

Usage

meshtastic --dest \!28979058 --set-owner "MeshyJohn"

--set-ham SET_HAM

Set licensed Ham ID and turn off encryption.

Usage

meshtastic --set-ham KI1345

--dest DEST

The destination node id for any sent commands

Usage

meshtastic --dest \!28979058 --set-owner "MeshyJohn"

--sendtext SENDTEXT

Send a text message. Can specify a channel index ('--ch-index') or a destination ('--dest')

Usage

meshtastic --sendtext "Hello Mesh!"

--sendping

Send a ping message (which requests a reply).

Usage

meshtastic --sendping

--reboot

Tell the destination node to reboot.

Usage

meshtastic --dest \!28979058 --reboot

--reply

Reply to received messages.

Usage

meshtastic --reply

--gpio-wrb GPIO_WRB GPIO_WRB

Set a particular GPIO # to 1 or 0.

Usage

meshtastic --port /dev/ttyUSB0 --gpio-wrb 4 1 --dest \!28979058

--gpio-rd GPIO_RD

Read from a GPIO mask.

Usage

meshtastic --port /dev/ttyUSB0 --gpio-rd 0x10 --dest \!28979058

--gpio-watch GPIO_WATCH

Start watching a GPIO mask for changes.

Usage

meshtastic --port /dev/ttyUSB0 --gpio-watch 0x10 --dest \!28979058

--no-time

Suppress sending the current time to the mesh.

Usage

meshtastic --port /dev/ttyUSB0 --no-time

--setalt SETALT

Set device altitude (allows use without GPS).

Usage

meshtastic --setalt 120

--setlat SETLAT

Set device latitude (allows use without GPS).

Usage

meshtastic --setlat 25.2

--setlon SETLON

Set device longitude (allows use without GPS).

Usage

meshtastic --setlon -16.8

--debug

Show API library debug log messages.

Usage

meshtastic --debug --info

--test

Run stress test against all connected Meshtastic devices.

Usage

meshtastic --test

--ble BLE

BLE mac address to connect to (BLE is not yet supported for this tool).

Usage

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.

Usage

meshtastic --noproto

--version

Show program's version number and exit.

Usage

meshtastic --version

--configure

Configure all of the radio configuration from a yaml file.

Usage

meshtastic --configure example_config.yaml

--export-config

Export the configuration of the device. (to be consumed by the '--configure' command)

Usage

meshtastic --export-config

--support

Print out info that would be helpful supporting any issues.

Usage

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.