Skip to main content

Meshtastic MQTT Parser

A lightweight Python library for parsing Meshtastic MQTT messages into JSON format. This tool makes it easy to build applications that interact with Meshtastic mesh networks via MQTT.

Overview

This library connects to a Meshtastic MQTT broker and decodes various message types into JSON format, making it simple to process Meshtastic mesh network data in your Python applications.

Features

  • Connects to any Meshtastic MQTT broker
  • Decrypts encrypted messages
  • Parses all standard Meshtastic message types
  • Outputs clean JSON format
  • Message type filtering support
  • Simple command-line interface

Installation

Install from PyPI:

pip install meshtastic-mqtt-json

usage

meshtastic_mqtt_json [options]
from meshtastic_mqtt_json import MeshtasticMQTT

# Create client instance
client = MeshtasticMQTT()

# Register callbacks for specific message types
def on_text_message(json_data):
    print(f'Received text message: {json_data["decoded"]["payload"]}')

def on_position(json_data):
    print(f'Received position update: {json_data["decoded"]["payload"]}')

client.register_callback('TEXT_MESSAGE_APP', on_text_message)
client.register_callback('POSITION_APP', on_position)

# Connect to MQTT broker
client.connect(
    broker='mqtt.meshtastic.org',
    port=1883,
    root='msh/US/2/e/',
    channel='LongFast',
    username='meshdev',
    password='large4cats',
    key='AQ=='
)

Callback System

The library provides a callback system that allows you to register handlers for specific message types. Each callback function receives a JSON object containing the parsed message data.

# Register a callback
client.register_callback('MESSAGE_TYPE', callback_function)

# Unregister a callback
client.unregister_callback('MESSAGE_TYPE')

The callback function should accept a single parameter that will receive the JSON data:

def my_callback(json_data):
    # json_data contains the parsed message
    print(json_data)

If no callback is registered for a message type, the message will be printed to the console by default.

Command Line Options

Option Description Default
--broker MQTT broker address mqtt.meshtastic.org
--port MQTT broker port 1883
--root Root topic msh/US/2/e/
--channel Channel name LongFast
--username MQTT username meshdev
--password MQTT password large4cats
--key Encryption key AQ==
--filter Filter specific message types

Filter Example

python meshtastic_mqtt_json.py --filter "NODEINFO,POSITION,TEXT_MESSAGE"

Supported Message Types

The library supports parsing of the following Meshtastic message types:

Message Type Description
ADMIN_APP Administrative messages
ATAK_FORWARDER ATAK forwarding messages
ATAK_PLUGIN ATAK plugin messages
AUDIO_APP Audio messages
DETECTION_SENSOR_APP Sensor detection data
IP_TUNNEL_APP IP tunneling messages
NEIGHBORINFO_APP Neighbor information
NODEINFO_APP Node information and details
PAXCOUNTER_APP People counter data
POSITION_APP GPS position updates
PRIVATE_APP Private messages
RANGE_TEST_APP Range testing data
REMOTE_HARDWARE_APP Remote hardware control
REPLY_APP Reply messages
ROUTING_APP Routing information
SERIAL_APP Serial communication
SIMULATOR_APP Simulator messages
STORE_FORWARD_APP Store and forward messages
TELEMETRY_APP Device telemetry data
TEXT_MESSAGE_APP Plain text messages
TEXT_MESSAGE_COMPRESSED_APP Compressed text messages
TRACEROUTE_APP Network route tracing
WAYPOINT_APP Waypoint information
ZPS_APP Zone/Position System messages

Roadmap

  • Add support for custom node ID & names for the client
  • Add support for custom MQTT servers besides the official Meshtastic server
  • Create a PyPi package for easy import into other projects
  • Create an examples folder with use cases for the library, such as an IRC relay, cli chat, logging, etc.

Mirrors for this repository: acid.vegas • SuperNETs • GitHub • GitLab • Codeberg

Metadata

Release files for meshtastic-mqtt-json 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meshtastic-mqtt-json 3.0.0
File Size Uploaded Provenance Actions
meshtastic_mqtt_json-3.0.0.tar.gz 10.3 kB Without provenance Details for meshtastic_mqtt_json-3.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for meshtastic-mqtt-json 3.0.0
File Interpreter ABI Platform Actions
meshtastic_mqtt_json-3.0.0-py3-none-any.whl Python 3 none any Details for meshtastic_mqtt_json-3.0.0-py3-none-any.whl

Total release size: 19.2 kB

Release files / meshtastic_mqtt_json-3.0.0.tar.gz

Download URL meshtastic_mqtt_json-3.0.0.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
312a295f7e1d21cd55d306180cec7fd0461ab8d034b6a6e8eea81421bdf7e17b
BLAKE2b-256 checksum
How to use checksums
76de2b35b7bfe8c0fecc7c538fbca849c46509afc58ff2c8f0d7486f43b1eaa8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / meshtastic_mqtt_json-3.0.0-py3-none-any.whl

Download URL meshtastic_mqtt_json-3.0.0-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc991786edca415f3281c1e4db3fd875d6a4fe03255b5f8c47a029a95bc06af1
BLAKE2b-256 checksum
How to use checksums
a93d0419943247ee99c5d41adb0efb7f0e6ba9ed31093eebfdb17ed1148d1a70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for meshtastic-mqtt-json 3.0.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page