mirror of
https://github.com/meshtastic/meshtastic.git
synced 2024-12-28 06:59:45 -08:00
479 lines
9.2 KiB
Plaintext
479 lines
9.2 KiB
Plaintext
---
|
|
id: python-cli
|
|
title: Meshtastic Python CLI Guide
|
|
slug: /software/python/cli
|
|
sidebar_label: Python CLI
|
|
sidebar_position: 4
|
|
---
|
|
|
|
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.
|
|
|
|
```shell title="Usage"
|
|
meshtastic -h
|
|
```
|
|
### --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.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --export-config > example_config.yaml
|
|
```
|
|
|
|
```title="Usage"shell
|
|
meshtastic --export-config
|
|
```
|
|
|
|
### --configure
|
|
|
|
Configure radio using a yaml file.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --configure example_config.yaml
|
|
```
|
|
|
|
### --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.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --port /dev/ttyUSB0 --info
|
|
meshtastic --port COM4 --info
|
|
```
|
|
|
|
### --host HOST
|
|
|
|
The hostname/ipaddr of the device to connect to (over TCP).
|
|
|
|
```shell title="Usage"
|
|
meshtastic --host HOST
|
|
```
|
|
|
|
### --seriallog SERIALLOG
|
|
|
|
Logs device serial output to either 'stdout', 'none' or a filename to append to.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --port /dev/ttyUSB0 --seriallog
|
|
```
|
|
|
|
### --info
|
|
|
|
Read and display the radio config information.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --port /dev/ttyUSB0 --info
|
|
```
|
|
|
|
### --set-canned-message
|
|
|
|
Set the canned message plugin messages separated by pipes `|` (up to 200 characters).
|
|
|
|
```shell title="Usage"
|
|
meshtastic --set-canned-message "I need an alpinist!|Call Me|Roger Roger|Keep Calm|On my way"
|
|
```
|
|
|
|
### --get-canned-message
|
|
|
|
Show the canned message plugin message.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --get-canned-message
|
|
```
|
|
|
|
### --set-ringtone RINGTONE
|
|
|
|
Set the Notification Ringtone (up to 230 characters).
|
|
|
|
```shell title="Usage"
|
|
meshtastic --set-ringtone "LeisureSuit:d=16,o=6,b=56:f.5,f#.5,g.5,g#5,32a#5,f5,g#.5,a#.5,32f5,g#5,32a#5,g#5,8c#.,a#5,32c#,a5,a#.5,c#.,32a5,a#5,32c#,d#,8e,c#.,f.,f.,f.,f.,f,32e,d#,8d,a#.5,e,32f,e,32f,c#,d#.,c#"
|
|
```
|
|
|
|
### --get-ringtone
|
|
|
|
Show the stored ringtone.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --get-ringtone
|
|
```
|
|
|
|
### --nodes
|
|
|
|
Prints a node list in a pretty, formatted table.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --nodes
|
|
```
|
|
|
|
### --qr
|
|
|
|
Displays the QR code that corresponds to the current channel.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --qr
|
|
```
|
|
|
|
### --get [config_section]
|
|
|
|
Gets a preferences field.
|
|
|
|
Configuration values are described in: [Configuration](https://meshtastic.org/docs/configuration).
|
|
|
|
```shell title="Usage"
|
|
meshtastic --get lora
|
|
meshtastic --get lora.region
|
|
```
|
|
|
|
### --set [config_section].[option] [value]
|
|
|
|
Sets a preferences field.
|
|
|
|
Configuration values are described in: [Configuration](https://meshtastic.org/docs/configuration).
|
|
|
|
```shell title="Usage"
|
|
meshtastic --set lora.region Unset
|
|
```
|
|
|
|
### --seturl SETURL
|
|
|
|
Set a channel URL.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --seturl https://www.meshtastic.org/c/GAMiIE67C6zsNmlWQ-KE1tKt0fRKFciHka-DShI6G7ElvGOiKgZzaGFyZWQ=
|
|
```
|
|
|
|
### --ch-index CH_INDEX
|
|
|
|
Set the specified channel index.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --ch-index 1 --ch-disable
|
|
```
|
|
|
|
### --ch-add CH_ADD
|
|
|
|
Add a secondary channel, you must specify a channel name.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --ch-add testing-channel
|
|
```
|
|
|
|
### --ch-del
|
|
|
|
Delete the ch-index channel.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --ch-index 1 --ch-del
|
|
```
|
|
|
|
### --ch-enable
|
|
|
|
Enable the specified channel.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --ch-index 1 --ch-enable
|
|
```
|
|
|
|
### --ch-disable
|
|
|
|
Disable the specified channel.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --ch-index 1 --ch-disable
|
|
```
|
|
|
|
### --ch-set CH_SET CH_SET
|
|
|
|
Set a channel parameter.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --ch-set id 1234 --ch-index 0
|
|
```
|
|
|
|
### --ch-vlongslow
|
|
|
|
Change modem preset to `VERY_LONG_SLOW`.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --ch-vlongslow
|
|
```
|
|
|
|
### --ch-longslow
|
|
|
|
Change modem preset to `LONG_SLOW`.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --ch-longslow
|
|
```
|
|
|
|
### --ch-longfast
|
|
|
|
Change modem preset to (the default) `LONG_FAST`.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --ch-longfast
|
|
```
|
|
|
|
### --ch-medslow
|
|
|
|
Change modem preset to `MEDIUM_SLOW`.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --ch-medslow
|
|
```
|
|
|
|
### --ch-medfast
|
|
|
|
Change modem preset to `MEDIUM_FAST`.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --ch-medfast
|
|
```
|
|
|
|
### --ch-shortslow
|
|
|
|
Change modem preset to `SHORT_SLOW`.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --ch-shortslow
|
|
```
|
|
|
|
### --ch-shortfast
|
|
|
|
Change modem preset to `SHORT_FAST`.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --ch-shortfast
|
|
```
|
|
|
|
### --set-owner SET_OWNER
|
|
|
|
Set device owner name.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --set-owner "MeshyJohn"
|
|
```
|
|
|
|
### --set-owner-short SET_OWNER_SHORT
|
|
|
|
Set device owner short name (4 characters max).
|
|
|
|
```shell title="Usage"
|
|
meshtastic --set-owner-short "MJ"
|
|
```
|
|
|
|
### --set-ham SET_HAM
|
|
|
|
Set licensed Ham ID and turn off encryption.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --set-ham KI1345
|
|
```
|
|
|
|
### --dest DEST
|
|
|
|
The destination node id for any sent commands. Used for [Remote Node Administration](/docs/configuration/remote-admin)
|
|
|
|
```shell title="Usage"
|
|
meshtastic --dest '!28979058' --set-owner "MeshyJohn"
|
|
```
|
|
|
|
### --sendtext SENDTEXT
|
|
|
|
Send a text message. Can specify a channel index ('--ch-index') or a destination ('--dest').
|
|
|
|
```shell title="Usage"
|
|
meshtastic --sendtext "Hello Mesh!"
|
|
```
|
|
|
|
### --sendping
|
|
|
|
Send a ping message (which requests a reply).
|
|
|
|
```shell title="Usage"
|
|
meshtastic --sendping
|
|
```
|
|
|
|
### --traceroute TRACEROUTE
|
|
|
|
Traceroute from connected node to a destination. You need pass the destination ID as an argument. Only nodes that have the encryption key can be traced.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --traceroute '!ba4bf9d0'
|
|
```
|
|
|
|
### --request-telemetry
|
|
|
|
Request telemetry from a node. You need to pass the destination ID as an argument with '--dest'. For repeaters, the nodeNum is required.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --request-telemetry --dest '!ba4bf9d0'
|
|
meshtastic --request-telemetry --dest 1828779180
|
|
```
|
|
|
|
### --ack
|
|
|
|
Used in combination with --sendtext to wait for an acknowledgment.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --sendtext "Hello Mesh!" --ack
|
|
```
|
|
|
|
### --reboot
|
|
|
|
Tell the node to reboot.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --reboot
|
|
```
|
|
|
|
### --shutdown
|
|
|
|
Tell the node to shutdown.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --shutdown
|
|
```
|
|
|
|
### --factory-reset
|
|
|
|
Tell the node to install the default config.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --factory-reset
|
|
```
|
|
|
|
### --reset-nodedb
|
|
|
|
Tell the node to clear its list of nodes.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --reset-nodedb
|
|
```
|
|
|
|
### --reply
|
|
|
|
Reply to received messages.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --reply
|
|
```
|
|
|
|
### --gpio-wrb GPIO_WRB GPIO_WRB
|
|
|
|
Set a particular GPIO # to 1 or 0.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --port /dev/ttyUSB0 --gpio-wrb 4 1 --dest '!28979058'
|
|
```
|
|
|
|
### --gpio-rd GPIO_RD
|
|
|
|
Read from a GPIO mask.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --port /dev/ttyUSB0 --gpio-rd 0x10 --dest '!28979058'
|
|
```
|
|
|
|
### --gpio-watch GPIO_WATCH
|
|
|
|
Start watching a GPIO mask for changes.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --port /dev/ttyUSB0 --gpio-watch 0x10 --dest '!28979058'
|
|
```
|
|
|
|
### --no-time
|
|
|
|
Suppress sending the current time to the mesh.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --port /dev/ttyUSB0 --no-time
|
|
```
|
|
|
|
### --setalt SETALT
|
|
|
|
Set device altitude (allows use without GPS).
|
|
|
|
```shell title="Usage"
|
|
meshtastic --setalt 120
|
|
```
|
|
|
|
### --setlat SETLAT
|
|
|
|
Set device latitude (allows use without GPS).
|
|
|
|
```shell title="Usage"
|
|
meshtastic --setlat 25.2
|
|
```
|
|
|
|
### --setlon SETLON
|
|
|
|
Set device longitude (allows use without GPS).
|
|
|
|
```shell title="Usage"
|
|
meshtastic --setlon -16.8
|
|
```
|
|
|
|
### --debug
|
|
|
|
Show API library debug log messages.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --debug --info
|
|
```
|
|
|
|
### --test
|
|
|
|
Run stress test against all connected Meshtastic devices.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --test
|
|
```
|
|
|
|
### --ble BLE
|
|
|
|
Connect to a Meshtastic device using its BLE address or name. This option allows for wireless communication with the device, similar to how the `--host` option is used for TCP connections.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --ble "device_name_or_address" --info
|
|
```
|
|
|
|
### --ble-scan
|
|
|
|
Scan for available Meshtastic devices using BLE. This command lists discoverable devices, providing a convenient method to identify devices for connection via BLE.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --ble-scan
|
|
```
|
|
|
|
### --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.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --noproto
|
|
```
|
|
|
|
### --version
|
|
|
|
Show program's version number and exit.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --version
|
|
```
|
|
|
|
### --support
|
|
|
|
Print out info that would be helpful supporting any issues.
|
|
|
|
```shell title="Usage"
|
|
meshtastic --support
|
|
``` |