https://github.com/filipspl/meshmqttmonitor
MQTT Node Monitor for Meshtastic in console
https://github.com/filipspl/meshmqttmonitor
console meshtastic meshtastic-python monitoring-tool mqtt
Last synced: about 2 months ago
JSON representation
MQTT Node Monitor for Meshtastic in console
- Host: GitHub
- URL: https://github.com/filipspl/meshmqttmonitor
- Owner: filipsPL
- License: mit
- Created: 2024-08-31T19:24:23.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-19T08:49:31.000Z (over 1 year ago)
- Last Synced: 2025-03-11T10:50:50.419Z (over 1 year ago)
- Topics: console, meshtastic, meshtastic-python, monitoring-tool, mqtt
- Language: Python
- Homepage:
- Size: 335 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MQTT Node Monitor for Meshtastic
## Overview
This program connects to an MQTT broker to monitor messages from [Meshtastic](https://meshtastic.org/) nodes. It displays the data in a terminal-based interface, providing both a summary of the last message from each node and a detailed table of all messages. The program uses color-coded dots to indicate the age of the last message, making it easy to see the freshness of the data at a glance.

## Features
- **Real-time Monitoring**: Continuously listens to an MQTT topic and processes messages as they arrive.
- **Alias Mapping**: Converts node IDs to human-readable names using an alias map.
- **Message Age Indication**: Uses colored dots to indicate how recent each message is, with colors ranging from green (very recent) to black (older than 2 hours).
- **Configurable**: All MQTT settings and node configurations are managed via a configuration file (`config.py`).
## Requirements
This program requires Python 3.x. You will also need to install the following Python packages:
- `paho-mqtt`: For connecting to and interacting with the MQTT broker.
- `termcolor`: For printing colored text in the terminal.
- `tabulate`: For formatting data into a nice-looking table.
### Installation of Required Packages
You can install the required packages using pip:
```bash
pip install paho-mqtt termcolor tabulate
```
## Configuration
The program relies on a configuration file (`config.py`) to specify MQTT settings, alias mappings, and color mappings. Below is an example of what your `config.py` should look like:
```python
# Define MQTT settings
MQTT_BROKER = "your_mqtt_broker_address"
MQTT_PORT = 8883
MQTT_TOPIC = "your/mqtt/topic/#"
MQTT_USERNAME = "your_mqtt_username"
MQTT_PASSWORD = "your_mqtt_password"
# SSL Usage
USE_SSL = True
# Alias mapping for node IDs to human-readable names
ALIAS_MAP = {
"!node1id": "Node 1",
"!node2id": "Node 2",
# Add more node IDs and corresponding aliases here
}
# Color mapping for aliases
COLOR_MAP = {
"Node 1": "yellow",
"Node 2": "cyan",
# Add more aliases and corresponding colors here
}
# Fields to ignore in the message display
IGNORE_FIELDS = ['from', 'to', 'type', 'id', 'timestamp', 'node_id']
```
### Explanation of Configuration Parameters
- **MQTT_BROKER**: The address of your MQTT broker.
- **MQTT_PORT**: The port used by your MQTT broker (default for MQTT over SSL is 8883).
- **MQTT_TOPIC**: The MQTT topic to subscribe to (wildcards can be used to subscribe to multiple topics).
- **MQTT_USERNAME**: Your MQTT username.
- **MQTT_PASSWORD**: Your MQTT password.
- **USE_SSL**: Boolean value to indicate if SSL should be used.
- **ALIAS_MAP**: A dictionary mapping node IDs to human-readable names.
- **COLOR_MAP**: A dictionary mapping node aliases to colors for terminal display.
- **IGNORE_FIELDS**: List of fields in the MQTT message that should be ignored in the display.
## Running the Program
To run the program, simply execute the Python script in your terminal:
```bash
python meshmqttmonitor.py
```
Ensure that the `config.py` file is in the same directory as your script. The file `config.py.txt` is provided as an example.
## License
This project is licensed under the MIT License.