Skip to main content

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:

import mmqtt
mmqtt.send_nodeinfo(short_name, long_name, hw_model)
mmqtt.send_position(lat, lon, alt, precision)
mmqtt.send_device_telemetry(battery_level, voltage, chutil, airtxutil, uptime)
mmqtt.send_text_message("text")

Available arguments:

  -h, --help             show this help message and exit
  --config CONFIG        Path to the config file
  --message MESSAGE      The message to send
  --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
  --nodeinfo             Send NodeInfo from my config
  --telemetry            Send telemetry from my config
  --listen               Enable listening 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.yaml:

{
  "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,
    "hw_model": 255
  },
  "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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mmqtt-1.0.9.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mmqtt-1.0.9-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file mmqtt-1.0.9.tar.gz.

File metadata

  • Download URL: mmqtt-1.0.9.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mmqtt-1.0.9.tar.gz
Algorithm Hash digest
SHA256 4b76faabb1d2ddf13e32b8b8c3d09cb0514feb09d99f5f4c8c61fafe07f53048
MD5 e6e240a2e56fa652c9f684535136c7e0
BLAKE2b-256 0418596b0d4483eac0e29d6e53744176f6c289ba14155aef3af785dddca05f7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for mmqtt-1.0.9.tar.gz:

Publisher: release.yaml on pdxlocations/mmqtt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mmqtt-1.0.9-py3-none-any.whl.

File metadata

  • Download URL: mmqtt-1.0.9-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mmqtt-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 bffa91a9ceb261ae08f15a9e4a410c5fe4deb3098da9f224214b39baec96c87a
MD5 3b5e606ff7ceb60dfda4bb18a574bcc1
BLAKE2b-256 30c71b4719696d1e9eb3f9361496ab78e0da71ae5820b9cef5370d6854f7d5c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mmqtt-1.0.9-py3-none-any.whl:

Publisher: release.yaml on pdxlocations/mmqtt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page