This library may be useful for testing Meshtastic networks connected to an MQTT server.
Project description
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
For development
python3 -m venv .venv
source .venv/bin/activate
pip install poetry
poetry build
pip install dist/mmqtt*.whl
To run:
mmqtt
Available functions (see examples for further information):
from mmqtt import send_nodeinfo, send_position, send_device_telemetry, send_text_message
send_nodeinfo(node_id, long_name, short_name)
send_position(lattitude, longitude, altitude, location_precision)
send_device_telemetry(battery_level, voltage, chutil, airtxutil, uptime)
send_text_message("text")
Optional Arguments:
to=INT
hop_start=INT
hop_limit=INT
want_ack=BOOL
want_response=BOOL
Example:
send_text_message("Happy New Year" to=12345678, hop_limit=5)
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"
}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mmqtt-1.1.0.tar.gz.
File metadata
- Download URL: mmqtt-1.1.0.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccc6f1d7ebc3d7830af956720f1487a4b60af7f01fc510d4e15a59d12495997d
|
|
| MD5 |
7fbb7269c93c8155dbb88e33bb68ce77
|
|
| BLAKE2b-256 |
9323a0f6f5ee2efb5119f38287379542c6058d2f8f0e1b436c7f381f7a260541
|
Provenance
The following attestation bundles were made for mmqtt-1.1.0.tar.gz:
Publisher:
release.yaml on pdxlocations/mmqtt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mmqtt-1.1.0.tar.gz -
Subject digest:
ccc6f1d7ebc3d7830af956720f1487a4b60af7f01fc510d4e15a59d12495997d - Sigstore transparency entry: 197553848
- Sigstore integration time:
-
Permalink:
pdxlocations/mmqtt@82ae23f25d52f5a32f739abe7dbeda1171e39a34 -
Branch / Tag:
refs/tags/1.1.0 - Owner: https://github.com/pdxlocations
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@82ae23f25d52f5a32f739abe7dbeda1171e39a34 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mmqtt-1.1.0-py3-none-any.whl.
File metadata
- Download URL: mmqtt-1.1.0-py3-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e88465f3035241755deb0114ba4a92ee9d1753565d2422f70ead559dcbaeb007
|
|
| MD5 |
6b8eddeebcf389cd71fee5f18bb7e970
|
|
| BLAKE2b-256 |
dbf68278c73d2d2d594dddf6f47af5f781a473b1a15d6bd8bb7b5d18e0e97157
|
Provenance
The following attestation bundles were made for mmqtt-1.1.0-py3-none-any.whl:
Publisher:
release.yaml on pdxlocations/mmqtt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mmqtt-1.1.0-py3-none-any.whl -
Subject digest:
e88465f3035241755deb0114ba4a92ee9d1753565d2422f70ead559dcbaeb007 - Sigstore transparency entry: 197553850
- Sigstore integration time:
-
Permalink:
pdxlocations/mmqtt@82ae23f25d52f5a32f739abe7dbeda1171e39a34 -
Branch / Tag:
refs/tags/1.1.0 - Owner: https://github.com/pdxlocations
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@82ae23f25d52f5a32f739abe7dbeda1171e39a34 -
Trigger Event:
push
-
Statement type: