Improvements to the python tool: It now does reflection

The python tool lets you set various parameters. But until recently it had no way to list the possible parameters. Also, some parameters are enums and it only supported setting those parameters by using a number.

Both of these problems are now fixed. So if you don’t know what your choices are for an enum you can get a list from the tool. We use reflection to always pull the current choices from the protobufs.

Examples:

meshtastic --set region XXX
Connected to radio
region doesn't have an enum called XXX, so you can not set it.
Choices are:
  Unset
  US
  EU433
  EU865
  CN
  JP
  ANZ
  KR
  TW
  RU
Writing modified preferences to device
~/development/meshtastic/meshtastic-python$ meshtastic --ch-set XXX true
Connected to radio
ChannelSettings doesn't have an attribute called XXX, so you can not set it.
Choices are:
  tx_power
  modem_config
  bandwidth
  spread_factor
  coding_rate
  channel_num
  psk
  name
  id
  uplink_enabled
  downlink_enabled
Writing modified channels to device
~/development/meshtastic/meshtastic-python$ meshtastic --set XXX 5
Connected to radio
UserPreferences doesn't have an attribute called XXX, so you can not set it.
Choices are:
  position_broadcast_secs
  send_owner_interval
  wait_bluetooth_secs
  screen_on_secs
  phone_timeout_secs
  phone_sds_timeout_sec
  mesh_sds_timeout_secs
  sds_secs
  ls_secs
  min_wake_secs
  wifi_ssid
  wifi_password
  wifi_ap_mode
  region
  charge_current
  is_router
  is_low_power
  fixed_position
  factory_reset
  debug_log_enabled
  location_share
  gps_operation
  gps_update_interval
  gps_attempt_time
  ignore_incoming
  serialplugin_enabled
  serialplugin_echo
  serialplugin_rxd
  serialplugin_txd
  serialplugin_timeout
  serialplugin_mode
  ext_notification_plugin_enabled
  ext_notification_plugin_output_ms
  ext_notification_plugin_output
  ext_notification_plugin_active
  ext_notification_plugin_alert_message
  ext_notification_plugin_alert_bell
  range_test_plugin_enabled
  range_test_plugin_sender
  range_test_plugin_save
  store_forward_plugin_enabled
  store_forward_plugin_records
  environmental_measurement_plugin_measurement_enabled
  environmental_measurement_plugin_screen_enabled
  environmental_measurement_plugin_read_error_count_threshold
  environmental_measurement_plugin_update_interval
  environmental_measurement_plugin_recovery_interval
  environmental_measurement_plugin_display_farenheit
  environmental_measurement_plugin_sensor_type
  environmental_measurement_plugin_sensor_pin
Writing modified preferences to device
~/development/meshtastic/meshtastic-python$ 
15 Likes

Very nice. Meshtastic is quickly shaping up to a very professional level way beyond similar projects.

Thanks Kevin!

2 Likes

Yes the rate of development is fantastic. Really appreciate the hard work.

3 Likes

Many-many-many big thanks to Kevin and all the developer-coders who are moving the project forward!

2 Likes

I’ve been looking for a list of all the parameters that can be set, this is great. I’ll add it to the documentation!

Btw the low level protocol bufs docs (including the parameters) are auto generated here: https://www.github.com/meshtastic/Meshtastic-protobufs/tree/master/docs%2Fdocs.md

1 Like