meshtastic / python

The Python CLI and API for talking to Meshtastic devices
https://meshtastic.org
379 stars 160 forks source link

write a "dump-config" type option that would do the opposite of the "--configure" option #143

Closed mkinney closed 2 years ago

mkinney commented 2 years ago

It would be nice if we had a way to dump config values to a yaml file.

mkinney commented 2 years ago

@thebentern Any interesting in taking a stab at a prototype?

mkinney commented 2 years ago

Interesting...

% meshtastic --configure-dump
Connected to radio
# start of Meshtastic configure yaml
owner: Unknown 67cc

channel_url: https://www.meshtastic.org/d/#CgUYASIBAQ

location:
  lat: 110.0
  lon: 120.0
  alt: 100

user_prefs:
  phone_timeout_secs: 900
  ls_secs: 300
  position_broadcast_smart: 'true'
  fixed_position: 'true'
  position_flags: 35

Then I edited the file:

owner: Mike

channel_url: https://www.meshtastic.org/d/#CgUYASIBAQ

location:
  lat: 210.0
  lon: 220.0
  alt: 200

user_prefs:
  phone_timeout_secs: 902
  ls_secs: 200
  position_broadcast_smart: 'false'
  fixed_position: 'true'
  position_flags: 35

Tried to configure it...

(venv) sweet Meshtastic-python % meshtastic --configure foo.yaml
Connected to radio
Setting device owner to Mike
Setting channel url to https://www.meshtastic.org/d/#CgUYASIBAQ
Fixing altitude at 200 meters
Fixing latitude at 210.0 degrees
Fixing longitude at 220.0 degrees
Setting device position
Aborting due to: Value out of range: 2200000000
mkinney commented 2 years ago

Works when you use sane values. :-)