2021-04-28 14:38:14 -07:00
---
id: python-cli
2021-12-29 10:49:34 -08:00
title: meshtastic command line interface guide
sidebar_label: meshtastic cli
2021-04-28 14:38:14 -07:00
---
2021-12-29 10:49:34 -08:00
# Meshtastic CLI Guide
2021-04-28 14:38:14 -07:00
2021-12-29 10:49:34 -08:00
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.
2021-04-28 14:38:14 -07:00
2021-12-29 10:49:34 -08:00
## Optional Arguments
### -h or --help
Shows a help message that describes the arguments.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-04-28 14:38:14 -07:00
meshtastic -h
```
2021-12-29 10:49:34 -08:00
### --port PORT
2022-01-24 02:25:53 -08:00
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.
2021-12-29 10:49:34 -08:00
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --port /dev/ttyUSB0 --info
meshtastic --port COM4 --info
```
### --host HOST
The hostname/ipaddr of the device to connect to (over TCP).
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --host HOST
```
### --seriallog SERIALLOG
Logs device serial output to either 'stdout', 'none' or a filename to append to.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --port /dev/ttyUSB0 --seriallog
```
### --info
Read and display the radio config information.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --port /dev/ttyUSB0 --info
```
### --nodes
Prints a node list in a pretty, formatted table.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --nodes
```
### --qr
Displays the QR code that corresponds to the current channel.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --qr
```
### --get GET
Gets a preferences field.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --get modem_config
```
### --set SET SET
Sets a preferences field.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --set region Unset
```
### --seturl SETURL
Set a channel URL.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --seturl https://www.meshtastic.org/c/GAMiIE67C6zsNmlWQ-KE1tKt0fRKFciHka-DShI6G7ElvGOiKgZzaGFyZWQ=
```
### --ch-index CH_INDEX
Set the specified channel index
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --ch-index 1 --ch-disable
```
### --ch-add CH_ADD
Add a secondary channel, you must specify a channel name.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --ch-add testing-channel
```
2022-01-24 02:25:53 -08:00
2021-12-29 10:49:34 -08:00
### --ch-del
Delete the ch-index channel.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --ch-index 1 --ch-del
```
### --ch-enable
Enable the specified channel.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --ch-index 1 --ch-enable
```
### --ch-disable
Disable the specified channel.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --ch-index 1 --ch-disable
```
### --ch-set CH_SET CH_SET
Set a channel parameter.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --ch-set id 1234 --ch-index 0
```
### --ch-longslow
Change to the standard long-range (but slow) channel.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --ch-longslow
```
### --ch-shortfast
Change to the standard fast (but short range) channel.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --ch-shortfast
```
### --set-owner SET_OWNER
Set device owner name.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
meshtastic --dest '!28979058' --set-owner "MeshyJohn"
2021-12-29 10:49:34 -08:00
```
### --set-ham SET_HAM
Set licensed Ham ID and turn off encryption.
2021-12-02 11:04:38 -08:00
2021-12-29 10:49:34 -08:00
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --set-ham KI1345
2021-12-02 11:04:38 -08:00
```
2021-12-29 10:49:34 -08:00
### --dest DEST
The destination node id for any sent commands
2021-04-28 14:38:14 -07:00
2021-12-29 10:49:34 -08:00
**Usage**
2021-04-28 14:38:14 -07:00
2022-01-24 02:25:53 -08:00
```shell
meshtastic --dest '!28979058' --set-owner "MeshyJohn"
2021-04-28 14:38:14 -07:00
```
2021-12-29 10:49:34 -08:00
### --sendtext SENDTEXT
Send a text message. Can specify a channel index ('--ch-index') or a destination ('--dest')
2021-04-28 14:38:14 -07:00
2021-12-29 10:49:34 -08:00
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --sendtext "Hello Mesh!"
2021-04-28 14:38:14 -07:00
```
2021-12-29 10:49:34 -08:00
### --sendping
Send a ping message (which requests a reply).
2021-04-28 14:38:14 -07:00
2021-12-29 10:49:34 -08:00
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --sendping
2021-04-28 14:38:14 -07:00
```
2021-12-29 10:49:34 -08:00
### --reboot
Tell the destination node to reboot.
**Usage**
2021-04-28 14:38:14 -07:00
2022-01-24 02:25:53 -08:00
```shell
meshtastic --dest '!28979058' --reboot
2021-04-28 14:38:14 -07:00
```
2021-12-29 10:49:34 -08:00
### --reply
Reply to received messages.
**Usage**
2021-04-28 14:38:14 -07:00
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --reply
```
### --gpio-wrb GPIO_WRB GPIO_WRB
2021-04-28 14:38:14 -07:00
2021-12-29 10:49:34 -08:00
Set a particular GPIO # to 1 or 0.
2021-04-28 14:38:14 -07:00
2021-12-29 10:49:34 -08:00
**Usage**
2021-04-28 14:38:14 -07:00
2022-01-24 02:25:53 -08:00
```shell
meshtastic --port /dev/ttyUSB0 --gpio-wrb 4 1 --dest '!28979058'
2021-04-28 14:38:14 -07:00
```
2021-12-29 10:49:34 -08:00
### --gpio-rd GPIO_RD
Read from a GPIO mask.
2021-04-28 14:38:14 -07:00
2021-12-29 10:49:34 -08:00
**Usage**
2022-01-24 02:25:53 -08:00
```shell
meshtastic --port /dev/ttyUSB0 --gpio-rd 0x10 --dest '!28979058'
2021-04-28 14:38:14 -07:00
```
2021-12-29 10:49:34 -08:00
### --gpio-watch GPIO_WATCH
Start watching a GPIO mask for changes.
2021-04-28 14:38:14 -07:00
2021-12-29 10:49:34 -08:00
**Usage**
2021-04-28 14:38:14 -07:00
2022-01-24 02:25:53 -08:00
```shell
meshtastic --port /dev/ttyUSB0 --gpio-watch 0x10 --dest '!28979058'
2021-12-29 10:49:34 -08:00
```
### --no-time
Suppress sending the current time to the mesh.
2021-05-03 14:42:41 -07:00
2021-12-29 10:49:34 -08:00
**Usage**
2021-05-03 14:42:41 -07:00
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --port /dev/ttyUSB0 --no-time
2021-05-03 14:42:41 -07:00
```
2021-04-28 14:38:14 -07:00
2021-12-29 10:49:34 -08:00
### --setalt SETALT
2021-04-28 14:38:14 -07:00
2021-12-29 10:49:34 -08:00
Set device altitude (allows use without GPS).
2021-04-28 14:38:14 -07:00
2021-12-29 10:49:34 -08:00
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --setalt 120
2021-04-28 14:38:14 -07:00
```
2021-12-29 10:49:34 -08:00
### --setlat SETLAT
Set device latitude (allows use without GPS).
2021-04-28 14:38:14 -07:00
2021-12-29 10:49:34 -08:00
**Usage**
2021-04-28 14:38:14 -07:00
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --setlat 25.2
```
### --setlon SETLON
2021-04-28 15:03:23 -07:00
2021-12-29 10:49:34 -08:00
Set device longitude (allows use without GPS).
2021-04-28 14:38:14 -07:00
2021-12-29 10:49:34 -08:00
**Usage**
2021-04-28 15:03:23 -07:00
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --setlon -16.8
2021-04-28 14:38:14 -07:00
```
2021-12-29 10:49:34 -08:00
### --debug
Show API library debug log messages.
2021-04-28 14:38:14 -07:00
2021-12-29 10:49:34 -08:00
**Usage**
2021-04-28 14:38:14 -07:00
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --debug --info
2021-04-28 14:38:14 -07:00
```
2021-12-29 10:49:34 -08:00
### --test
Run stress test against all connected Meshtastic devices.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --test
```
### --ble BLE
BLE mac address to connect to (BLE is not yet supported for this tool).
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
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**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --noproto
```
### --version
Show program's version number and exit.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --version
```
### --configure
Configure all of the radio configuration from a yaml file.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --configure example_config.yaml
```
### --export-config
Export the configuration of the device. (to be consumed by the '--configure' command)
2022-01-07 18:27:15 -08:00
To create to a file with the connected device's configuration, this command's output must be piped to a yaml file
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2022-01-07 18:27:15 -08:00
meshtastic --export-config > example_config.yaml
```
2022-01-24 02:25:53 -08:00
2021-12-29 10:49:34 -08:00
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --export-config
```
### --support
Print out info that would be helpful supporting any issues.
**Usage**
2022-01-24 02:25:53 -08:00
```shell
2021-12-29 10:49:34 -08:00
meshtastic --support
```
## Deprecated Arguments
### --setchan
Deprecated - use "--ch-set param value" instead.
### --set-router
Deprecated - use "--set is_router true" instead.
### --unset-router
2022-02-01 07:50:43 -08:00
Deprecated - use "--set is_router false" instead.