Merge pull request #180 from mkinney/update_python_docs

remove duplicate page; re-format standalone; fix links
This commit is contained in:
mkinney 2022-01-12 11:16:59 -08:00 committed by GitHub
commit f681a2a180
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 409 deletions

View file

@ -1,396 +0,0 @@
---
id: python-commands
title: Meshtastic-python Commands
sidebar_label: Commands
---
# Python API Commands 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**
```shell
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**
```shell
meshtastic --port /dev/ttyUSB0 --info
meshtastic --port COM4 --info
```
### --host HOST
The hostname/ipaddr of the device to connect to (over TCP).
**Usage**
```shell
meshtastic --host HOST
```
### --seriallog SERIALLOG
Logs device serial output to either 'stdout', 'none' or a filename to append to.
**Usage**
```shell
meshtastic --port /dev/ttyUSB0 --seriallog
```
### --info
Read and display the radio config information.
**Usage**
```shell
meshtastic --port /dev/ttyUSB0 --info
```
### --nodes
Prints a node list in a pretty, formatted table.
**Usage**
```shell
meshtastic --nodes
```
### --qr
Displays the QR code that corresponds to the current channel.
**Usage**
```shell
meshtastic --qr
```
### --get GET
Gets a preferences field.
**Usage**
```shell
meshtastic --get modem_config
```
### --set SET SET
Sets a preferences field.
**Usage**
```shell
meshtastic --set region Unset
```
### --seturl SETURL
Set a channel URL.
**Usage**
```shell
meshtastic --seturl https://www.meshtastic.org/c/GAMiIE67C6zsNmlWQ-KE1tKt0fRKFciHka-DShI6G7ElvGOiKgZzaGFyZWQ=
```
### --ch-index CH_INDEX
Set the specified channel index
**Usage**
```shell
meshtastic --ch-index 1 --ch-disable
```
### --ch-add CH_ADD
Add a secondary channel, you must specify a channel name.
**Usage**
```shell
meshtastic --ch-add testing-channel
```
### --ch-del
Delete the ch-index channel.
**Usage**
```shell
meshtastic --ch-index 1 --ch-del
```
### --ch-enable
Enable the specified channel.
**Usage**
```shell
meshtastic --ch-index 1 --ch-enable
```
### --ch-disable
Disable the specified channel.
**Usage**
```shell
meshtastic --ch-index 1 --ch-disable
```
### --ch-set CH_SET CH_SET
Set a channel parameter.
**Usage**
```shell
meshtastic --ch-set id 1234
```
### --ch-longslow
Change to the standard long-range (but slow) channel.
**Usage**
```shell
meshtastic --ch-longslow
```
### --ch-shortfast
Change to the standard fast (but short range) channel.
**Usage**
```shell
meshtastic --ch-shortfast
```
### --set-owner SET_OWNER
Set device owner name.
**Usage**
```shell
meshtastic --dest \!28979058 --set-owner "MeshyJohn"
```
### --set-ham SET_HAM
Set licensed Ham ID and turn off encryption.
**Usage**
```shell
meshtastic --set-ham KI1345
```
### --dest DEST
The destination node id for any sent commands
**Usage**
```shell
meshtastic --dest \!28979058 --set-owner "MeshyJohn"
```
### --sendtext SENDTEXT
Send a text message.
**Usage**
```shell
meshtastic --sendtext "Hello Mesh!"
```
### --sendping
Send a ping message (which requests a reply).
**Usage**
```shell
meshtastic --sendping
```
### --reboot
Tell the destination node to reboot.
**Usage**
```shell
meshtastic --dest \!28979058 --reboot
```
### --reply
Reply to received messages.
**Usage**
```shell
meshtastic --reply
```
### --gpio-wrb GPIO_WRB GPIO_WRB
Set a particular GPIO # to 1 or 0.
**Usage**
```shell
meshtastic --port /dev/ttyUSB0 --gpio-wrb 4 1 --dest \!28979058
```
### --gpio-rd GPIO_RD
Read from a GPIO mask.
**Usage**
```shell
meshtastic --port /dev/ttyUSB0 --gpio-rd 0x10 --dest \!28979058
```
### --gpio-watch GPIO_WATCH
Start watching a GPIO mask for changes.
**Usage**
```shell
meshtastic --port /dev/ttyUSB0 --gpio-watch 0x10 --dest \!28979058
```
### --no-time
Suppress sending the current time to the mesh.
**Usage**
```shell
meshtastic --port /dev/ttyUSB0 --no-time
```
### --setalt SETALT
Set device altitude (allows use without GPS).
**Usage**
```shell
meshtastic --setalt 120
```
### --setlat SETLAT
Set device latitude (allows use without GPS).
**Usage**
```shell
meshtastic --setlat 25.2
```
### --setlon SETLON
Set device longitude (allows use without GPS).
**Usage**
```shell
meshtastic --setlon -16.8
```
### --debug
Show API library debug log messages.
**Usage**
```shell
meshtastic --debug --info
```
### --test
Run stress test against all connected Meshtastic devices.
**Usage**
```shell
meshtastic --test
```
### --ble BLE
BLE mac address to connect to (BLE is not yet supported for this tool).
**Usage**
```shell
meshtastic --ble "83:38:92:32:37:48"
```
### --noproto
Don't start the API, just function as a dumb serial terminal.
**Usage**
```shell
meshtastic --noproto
```
### --version
Show program's version number and exit.
**Usage**
```shell
meshtastic --version
```
## 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.

View file

@ -8,9 +8,9 @@ import TabItem from '@theme/TabItem';
This library provides a command line interface (CLI) for Meshtastic nodes and provides an easy API for sending and receiving messages over mesh radios, in addition to changing user settings. Using the command line is currently the most powerful. Events are delivered using a publish-subscribe model, and you can subscribe to only the message types you are interested in.
[Full documentation](https://meshtastic.org/docs/software/python/python-installation) for the library, including examples, is available.
The [Meshtastic-python repo](https://github.com/meshtastic/Meshtastic-python) and [API documentation](https://meshtastic-python.vercel.app/meshtastic/index.html) are excellent sources of information.
If you wish to view the code or contribute to development of the python library or the command line interface, please visit the Meshtastic python <a href="https://meshtastic.org/docs/software/python/python-installation">GitHub page</a>.
If you wish to view the code or contribute to development of the python library or the command line interface, please visit the Meshtastic python <a href="https://github.com/meshtastic/Meshtastic-python">GitHub page</a>.
There are standalone executables for Mac, Windows and Ubuntu if you do not want to install python and/or the python libraries required to run the mestastic CLI tool. See [Standalone](https://meshtastic.org/docs/software/python/python-standalone) for more information.

View file

@ -8,6 +8,8 @@ import TabItem from '@theme/TabItem';
There are standalone executable files for Mac, Windows and Ubuntu. A single file is all you need to run the command line interface (CLI) Meshtastic tool. There is a zip file per operating system. To use, see the operating system specific notes below:
They can be found on the [Releases](https://github.com/meshtastic/Meshtastic-python/releases) page.
<Tabs
groupId="operating-system"
@ -23,11 +25,25 @@ There are standalone executable files for Mac, Windows and Ubuntu. A single file
* Unzip.
* Run: "chmod +x meshtastic"
:::note
You may need to run `sudo apt-get install zip`
:::
* To run: "./meshtastic"
* Run the following command to make the file executable:
* Tip: Copy (or move) this binary somewhere in your path.
```
chmod +x meshtastic
```
* To run the cli:
```
./meshtastic
```
:::tip
Copy (or move) this binary somewhere in your path.
:::
</TabItem>
<TabItem value="macos">
@ -36,20 +52,46 @@ There are standalone executable files for Mac, Windows and Ubuntu. A single file
* Unzip.
* Run: "chmod +x meshtastic"
* Run the following command to make the file executable:
* Try to run it: "./meshtastic". You may get a dialog that says:
"meshtastic" can't be opened because Apple cannot check it for malicious software.
```
chmod +x meshtastic
```
* Try to run it:
```
./meshtastic
```
:::note
You may get a dialog that says:
"meshtastic" can't be opened because Apple cannot check it for malicious software.
:::
* To fix, go into "System Preferences", "Security & Privacy", "General" tab, and click on the "Allow Anyway" button.
* Try to run it again: "./meshtastic". You may get a dialog that says:
* Try to run it again:
```
./meshtastic
```
:::note
You may get a dialog that says:
"meshtastic" can't be opened because Apple cannot check it for malicious software.
Click "Open".
:::
* Now when you want to run it, you can simply run "./meshtastic".
* Now when you want to run it, you can simply run:
* Tip: Copy (or move) this binary somewhere in your path.
```
./meshtastic
```
:::tip
Copy (or move) this binary somewhere in your path.
:::
</TabItem>
<TabItem value="windows">
@ -58,7 +100,11 @@ There are standalone executable files for Mac, Windows and Ubuntu. A single file
* Unzip.
* To run, double click on "meshtastic.exe" or from a command prompt run "./meshtastic.exe"
* To run, double click on "meshtastic.exe" or from a command prompt run:
```
.\meshtastic.exe
```
</TabItem>
</Tabs>

View file

@ -53,7 +53,6 @@ module.exports = {
"software/python/python-standalone",
"software/python/python-cli",
"software/python/python-uses",
"software/python/python-commands",
"software/python/python-stream",
{
type: "link",