This project is useful for testing Meshtastic networks connected to an MQTT server. Functions can be called via the mmqtt command or imported and used programmatically.
Installation
pip install mmqtt
Functions (see examples for further information):
from mmqtt import (
send_nodeinfo,
send_device_telemetry,
send_position,
send_environment_metrics,
send_power_metrics,
send_health_metrics,
send_text_message,
)
send_nodeinfo(node_id, long_name, short_name)
send_device_telemetry()
send_position(latitude, longitude)
send_environment_metrics()
send_power_metrics()
send_health_metrics()
send_text_message("text")
Optional Arguments for all message types:
- to=INT
- hop_limit=INT
- hop_start=INT
- want_ack=BOOL
- want_response=BOOL
Example:
send_text_message("Happy New Year" to=12345678, hop_limit=5)
Supported keyword arguments for nodeinfo:
- id (required)
- long_name (required)
- short_name (required)
- hw_model
- is_licensed
- role
- public_key
Supported keyword arguments for device metrics:
- battery_level
- voltage
- channel_utilization
- air_util_tx
- uptime_seconds
Supported keyword arguments for position metrics:
- latitude (required)
- longitude (required)
- latitude_i
- longitude_i
- altitude
- precision_bits
- HDOP
- PDOP
- VDOP
- altitude_geoidal_separation
- altitude_hae
- altitude_source
- fix_quality
- fix_type
- gps_accuracy
- ground_speed
- ground_track
- next_update
- sats_in_view
- sensor_id
- seq_number
- timestamp
- timestamp_millis_adjust
Supported keyword arguments for environment metrics:
- temperature
- relative_humidity
- barometric_pressure
- gas_resistance
- voltage
- current
- iaq
- distance
- ir_lux
- lux
- radiation
- rainfall_1h
- rainfall_24h
- soil_moisture
- soil_temperature
- uv_lux
- weight
- white_lux
- wind_direction
- wind_gust
- wind_lull
- wind_speed
Supported keyword arguments for power metrics:
- ch1_voltage
- ch1_current
- ch2_voltage
- ch2_current
- ch3_voltage
- ch3_current
Supported keyword arguments for health metrics:
- heart_bpm
- spO2
- temperature
Command Line Interface:
mmqtt --args
Available arguments:
-h, --help show this help message and exit
--config CONFIG Path to the config file
--message MESSAGE Message to send. You can use this multiple times.
--message-file FILE Path to a file containing messages, one per line
--nodeinfo Send NodeInfo from my config
--telemetry Send telemetry from my config
--lat LAT Latitude coordinate
--lon LON Longitude coordinate
--alt ALT Altitude
--precision PRECISION Position Precision
--position Send position from config unless overridden by --lat, --lon, or --alt
--listen Stay connected and listen for incoming MQTT messages
Examples:
To publish a message to the broker using settings defined in config-example.json:
mmqtt --message "I need an Alpinist"
To publish a message to the broker using settings defined in my-config.json:
mmqtt --config "my-config.json" --message "I need an Alpinist"
Example config.json:
{
"mqtt": {
"broker": "mqtt.meshtastic.org",
"port": 1883,
"user": "meshdev",
"password": "large4cats",
"root_topic": "msh/US/2/e/"
},
"channel": {
"preset": "LongFast",
"key": "AQ=="
},
"nodeinfo": {
"id": "!deadbeef",
"short_name": "q",
"long_name": "mmqtt",
"hw_model": 255
},
"position": {
"lat": 45.43139,
"lon": -122.37354,
"alt": 9,
"location_source": "LOC_MANUAL",
"precision": 16
},
"telemetry": {
"battery_level": 99,
"voltage": 4.0,
"chutil": 3,
"airtxutil": 1,
"uptime": 420
},
"message": {
"text": "Happy New Year",
"destination_id": "4294967295"
},
"mode": {
"listen": "False"
}
}
Build and install locally:
python3 -m venv .venv
source .venv/bin/activate
pip install poetry
poetry build
pip install dist/mmqtt*.whl
Install in development (editable) mode:
pip install -e .
Metadata
Release files for mmqtt 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mmqtt-1.1.3.tar.gz | 23.6 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mmqtt-1.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 50.1 kB
Release files / mmqtt-1.1.3.tar.gz
| Download URL | mmqtt-1.1.3.tar.gz |
|---|---|
| Size | 23.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b035959a54716f2e56d4a1a698657e5c054d3d026ff82ace820ff5240fe8513e
|
|
BLAKE2b-256 checksum How to use checksums |
fc920ef4e19fce007c52dc0edc102d9a3e97f913f1751029381eef8411463ecd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 17, 2025.
Transparency logRelease files / mmqtt-1.1.3-py3-none-any.whl
| Download URL | mmqtt-1.1.3-py3-none-any.whl |
|---|---|
| Size | 26.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dd7698e63d76c51cf4dcec558f271b6e24b93101b5041f3ac80d2312cfbc70a2
|
|
BLAKE2b-256 checksum How to use checksums |
d72e68ec0984c2d68eb71ba84d5081a1178275d3700017f165c4ee9318544d58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 17, 2025.
Transparency logSecurity for mmqtt 1.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for mmqtt-1.1.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 17, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.