The Mesh Monitor provides a command-line interface for monitoring and displaying network status information. The CLI is built around the cli.py module and offers both one-shot and continuous monitoring modes.
The CLI allows you to:
python -m src.meshviewer.cli [OPTIONS]
| Option | Type | Default | Description |
|---|---|---|---|
--mode |
choice | continuous |
Display mode: oneshot or continuous |
--interval |
int | 30 |
Refresh interval for continuous mode (seconds) |
--tcp-host |
str | 192.168.0.114 |
TCP host for connection |
--tcp-port |
int | 4403 |
TCP port for connection |
--serial-port |
str | None | Serial port for connection (optional) |
--mode oneshot)Displays a single snapshot of the network status and exits.
python -m src.meshviewer.cli --mode oneshot
Output includes:
--mode continuous)Continuously monitors the network with periodic updates.
python -m src.meshviewer.cli --mode continuous --interval 60
Features:
The CLI attempts TCP connection by default:
python -m src.meshviewer.cli --tcp-host 192.168.1.100 --tcp-port 4403
For direct serial connection to a Meshtastic device:
python -m src.meshviewer.cli --serial-port /dev/ttyUSB0
When a serial port is specified but connection fails, the CLI automatically falls back to TCP connection.
Each node is displayed in the following format:
[node_id] [long_name:25] - [hw_model:21] : [battery_info] : [last_heard] - [uptime]
Example:
!12345678 John's Node - Heltec V3 : 85%, 3.7V : last heard T-00:05:23 Ago - up 12.5 hrs
!87654321 Remote Station - T-Beam V1.1 : Chg, 4.1V : last heard T-00:01:45 Ago - up 8.2 hrs
[level]%, [voltage]V (e.g., 85%, 3.7V)Chg, [voltage]V (e.g., Chg, 4.1V)T-[HH:MM:SS] Ago format showing time since last communicationup [X.X] hrs showing device uptime in hourspython -m src.meshviewer.cli --mode oneshot
python -m src.meshviewer.cli --mode continuous --interval 60
python -m src.meshviewer.cli --tcp-host 10.0.0.100 --tcp-port 4403
python -m src.meshviewer.cli --serial-port /dev/ttyUSB0 --tcp-host 192.168.1.50
The CLI includes robust error handling:
The CLI is designed to work seamlessly with the broader meshViewer ecosystem:
MeshConnectionManager as the GUIMeshInterface for consistent data handlingFor troubleshooting, you can enable debug output by modifying the CLI code to include the debug=True parameter in the text_oneshot() function call.
The CLI requires:
argparse for command-line argument parsingtime for timing and formattingMeshConnectionManager from the connection moduleMeshInterface from the interface moduleAll dependencies are included in the standard meshMonitor installation.