Merge pull request #127 from mkinney/add_python_example

add an example that ApertureMountain shared in discord
This commit is contained in:
Jm Casler 2021-12-02 11:07:44 -08:00 committed by GitHub
commit 5da74e0c71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View file

@ -18,7 +18,14 @@ meshtastic -h
Because of the growing nature of this project, not all commands may appear when using the help command with `meshtastic -h`.
:::
## Changing device settings
## Getting a list of User Preferences
You can get a list of user preferences by running '--get' with an invalid atrribute such as 'all'.
```bash
meshtastic --get all
```
## Changing settings
You can also use this tool to set any of the device parameters which are stored in persistent storage. For instance, here's how to set the device
to keep the bluetooth link alive for eight hours (any usage of the bluetooth protocol from your phone will reset this timer)

View file

@ -36,6 +36,21 @@ interface.close()
Note: Be sure to change the ip address in the code above to a valid ip address for your setup.
You can get and update settings like this:
```python
import meshtastic
interface = meshtastic.SerialInterface()
ourNode = interface.getNode('^local')
print(ourNode.radioConfig.preferences)
ourNode.radioConfig.preferences.gps_update_interval = 60
print(ourNode.radioConfig.preferences)
ourNode.writeConfig()
interface.close()
```
For the rough notes/implementation plan see [TODO](https://github.com/meshtastic/Meshtastic-python/blob/master/TODO.md). See the API for full details of how to use the library.
## A note to developers of this lib