python icon indicating copy to clipboard operation
python copied to clipboard

1.3 CLI Convenience Methods - Current Status

Open garthvh opened this issue 3 years ago • 3 comments

--get and --set methods are available for the new Config and ModuleConfig sections

Many convenience methods that use refactored objects like position for their functionality need to be fixed

  • [x] -h, --help
  • [ ] --configure CONFIGURE Specify a path to a yaml(.yml) file containing the desired settings for the connected device.
  • [ ] --export-config Export the configuration in yaml(.yml) format.
  • [x] --port PORT The port the Meshtastic device is connected to, i.e. /dev/ttyUSB0. If unspecified, we'll try to find it.
  • [x] --host HOST The hostname/ipaddr of the device to connect to (over TCP)
  • [x] --seriallog SERIALLOG Log device serial output to either 'stdout', 'none' or a filename to append to.
  • [x] --info Read and display the radio config information
  • [ ] --get-canned-message Show the canned message plugin message
  • [x] --nodes Print Node List in a pretty formatted table
  • [x] --qr Display the QR code that corresponds to the current channel
  • [x] --get GET Get a preferences field. Use an invalid field such as '0' to get a list of all fields.
  • [x] --set SET SET Set a preferences field.
  • [x] --seturl SETURL Set a channel URL
  • [x] --ch-index CH_INDEX Set the specified channel index. Channels start at 0 (0 is the PRIMARY channel).
  • [x] --ch-add CH_ADD Add a secondary channel, you must specify a channel name
  • [x] --ch-del Delete the ch-index channel
  • [x] --ch-enable Enable the specified channel
  • [x] --ch-disable Disable the specified channel
  • [x] --ch-set CH_SET CH_SET Set a channel parameter. To see channel settings available:'--ch-set all all --ch-index 0'. Can set the 'psk' using this command. To disable encryption on primary channel:'--ch-set psk none --ch-index 0'. To set encryption with a new random key on second channel:'--ch- set psk random --ch-index 1'. To set encryption back to the default:'--ch-set default --ch-index 0'. To set encryption with your own key: '--ch-set psk 0x1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b --ch-index 0'.
  • [x] --ch-vlongslow Change to the very long-range and slow channel
  • [x] --ch-longslow Change to the long-range and slow channel
  • [x] --ch-longfast Change to the long-range and fast channel
  • [x] --ch-medslow Change to the med-range and slow channel
  • [x] --ch-medfast Change to the med-range and fast channel
  • [x] --ch-shortslow Change to the short-range and slow channel
  • [x] --ch-shortfast Change to the short-range and fast channel
  • [ ] --set-owner SET_OWNER Set device owner name Need to remove old automatic short name functionality
  • [ ] --set-canned-message SET_CANNED_MESSAGE Set the canned messages plugin message (~ 200 characters).
  • [ ] --set-owner-short SET_OWNER_SHORT Set device owner short name - Only supports 3 characters
  • [x] --set-ham SET_HAM Set licensed Ham ID and turn off encryption
  • [x] --dest DEST The destination node id for any sent commands, if not set '^all' or '^local' is assumed as appropriate
  • [x] --sendtext SENDTEXT Send a text message. Can specify a destination '--dest' and/or channel index '--ch-index'.
  • [ ] --sendping Send a ping message (which requests a reply)
  • [x] --reboot Tell the destination node to reboot
  • [x] --shutdown Tell the destination node to shutdown
  • [x] --device-metadata Get the device metadata from the node
  • [ ] --reply Reply to received messages
  • [ ] --gpio-wrb GPIO_WRB GPIO_WRB Set a particular GPIO # to 1 or 0
  • [ ] --gpio-rd GPIO_RD Read from a GPIO mask (ex: '0x10')
  • [ ] --gpio-watch GPIO_WATCH Start watching a GPIO mask for changes (ex: '0x10')
  • [ ] --no-time Suppress sending the current time to the mesh Need to be removed, backing protos are gone
  • [x] --setalt SETALT Set device altitude (allows use without GPS)
  • [x] --setlat SETLAT Set device latitude (allows use without GPS)
  • [x] --setlon SETLON Set device longitude (allows use without GPS)
  • [ ] --pos-fields [POS_FIELDS ...] Specify fields to send when sending a position. Use no argument for a list of valid values. Can pass multiple values as a space separated list like this: '--pos-fields POS_ALTITUDE POS_ALT_MSL'
  • [x] --debug Show API library debug log messages
  • [x] --test Run stress test against all connected Meshtastic devices
  • [x] --ble BLE BLE mac address to connect to (BLE is not yet supported for this tool)\
  • [x] --noproto Don't start the API, just function as a dumb serial terminal.
  • [x] --version show program's version number and exit
  • [x] --support Show support info (useful when troubleshooting an issue)

garthvh avatar Aug 26 '22 15:08 garthvh

ch-set Appears to work with the latest fix. My testing:

ch-set psk 0x1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b --ch-index 0
ch-set psk random --ch-index 0
ch-set psk none --ch-index 0
ch-set channel_num 46 ch-index 0

thebentern avatar Aug 27 '22 18:08 thebentern

Almost all of the channel methods work now. Some of them bark with this, but it doesn't appear to affect the results:

meshtastic --ch-add 2ndLife
ERROR file:stream_interface.py __reader line:171 Error while handling message from radio argument of type 'NoneType' is not iterable
Traceback (most recent call last):
  File "c:\python38\lib\site-packages\meshtastic\stream_interface.py", line 169, in __reader
    self._handleFromRadio(self._rxBuf[HEADER_LEN:])
  File "c:\python38\lib\site-packages\meshtastic\mesh_interface.py", line 537, in _handleFromRadio
    self._handlePacketFromRadio(fromRadio.packet)
  File "c:\python38\lib\site-packages\meshtastic\mesh_interface.py", line 678, in _handlePacketFromRadio
    if "portnum" not in decoded:
Connected to radio

thebentern avatar Aug 27 '22 20:08 thebentern

perhaps it could help if in the cli the confirming message is not only that u have set a "fixes pos", but also the message that gps is disabled? like: Connected to radio Set position.fixed_position to true Set position.gps_enables to false Writing modified preferences to device

Bergstern avatar Sep 08 '22 15:09 Bergstern