Skip to main content

meshdb

A lightweight Python library for storing Meshtastic node, telemetry, and message data in per-node SQLite databases.

meshdb logo

## Installation

You can install meshdb directly from PyPI using pip:

pip install meshdb

Or install from source within a virtual environment:

git clone https://github.com/pdxlocations/meshdb.git
cd meshdb
pip install -e .

Or install via Poetry:

poetry install

Quick Usage Example

Set a default database path and handle incoming packets:

from meshdb import handle_packet, set_default_db_path

set_default_db_path("./data")

packet = {
    "from": 12345678,
    "rxTime": 1700000000,
    "decoded": {
        "portnum": "NODEINFO_APP",
        "user": {"longName": "TestNode"}
    }
}

handle_packet(packet, node_database_number=12345678)

Network Connection Options (Serial/TCP/Virtual Node)

meshdb now includes a connection helper that supports:

  • serial (default)
  • tcp
  • udp virtual-node mode
import meshdb

conn = meshdb.connect(
    transport="udp",
    virtual_node=meshdb.VirtualNodeConfig(
        node_id="!89abcdef",
        long_name="MeshDB Virtual Node",
        short_name="MDB",
        channel="LongFast",
        key="AQ==",
        mcast_group="239.0.0.69",
        mcast_port=4403,
    ),
)
print(conn.transport, conn.owner_node_num)

When receiving packets from udp, use meshdb.normalize_packet(packet, "udp") before passing to meshdb.handle_packet(...).

UDP collection is passive. VirtualNodeConfig.node_id selects a local storage owner; it does not claim a signed 2.8 identity or transmit nodeinfo. Use vnode for transmitting authenticated identities.

TCP addresses accept a hostname/IP, host:port, an IPv6 literal, or [IPv6]:port. The default port is 4403. For example, tcp_host="[::1]:4403".

examples/meshdb_demo.py demonstrates initial NodeDB synchronization and uses the same channel scope for writes and lookups. Set its channel name, PSK, and radio channel index to match your radio; the index and UDP wire hash are distinct.

CLI Listener

You can run:

meshdb
meshdb --db ./data --transport tcp --tcp-host 127.0.0.1:4403
meshdb --transport udp --node-id !89abcdef --channel LongFast

This connects to the mesh, listens for new packets, and persists them into the owner database until you stop it with Ctrl+C.

The CLI is configured with explicit arguments rather than environment variables. For udp transport, you can also pass:

  • --long-name
  • --short-name
  • --hw-model
  • --key
  • --mcast-group
  • --mcast-port

Owner Database

meshdb stores data per owner node. The owner_node_num value selects which owner's SQLite database and table set you are reading or writing.

That matters because the same remote node can appear differently depending on which local node observed it. Signal, last-heard time, hops, and even the available node list are owner-specific.

If you have a live Meshtastic interface and want to import its current NodeDB snapshot, you can do:

import meshdb

count = meshdb.sync_nodes_from_interface(owner_node_num, interface)
print(f"imported {count} nodes")

Lookups in Code

import meshdb

meshdb.set_default_db_path("./data")

node = meshdb.get_node(12345678, owner_node_num=12345678)
battery = meshdb.get_node_metric("TestNode", "battery_level", owner_node_num=12345678)

Project Status

Early development. Schema and API changes may occur.

License

GPL-3.0-only. See LICENSE.

Meshtastic® is a registered trademark of Meshtastic LLC. Meshtastic software components are released under various licenses, see GitHub for details. No warranty is provided - use at your own risk.

Packet signing metadata

UDP normalization preserves binary payloads, the signed Data envelope fields, and the base64 decoded.xeddsaSignature. Packet storage includes xeddsa_signature, xeddsa_signed, raw payload bytes (when supplied), and the signed envelope fields; node records include has_xeddsa_signed. Existing tables gain these columns automatically.

Signature presence is not proof of verification. UDP normalization always sets xeddsaSigned to false. Serial/TCP packet dictionaries can carry the connected radio's locally verified xeddsaSigned status. The node signing status latches verified observations for the same key and resets when that key changes.

Metadata

Release files for meshdb 0.3.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 meshdb 0.3.0
File Size Uploaded Provenance Actions
meshdb-0.3.0.tar.gz 38.1 kB With provenance Details for meshdb-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for meshdb 0.3.0
File Interpreter ABI Platform Actions
meshdb-0.3.0-py3-none-any.whl Python 3 none any Details for meshdb-0.3.0-py3-none-any.whl

Total release size: 77.4 kB

Release files / meshdb-0.3.0.tar.gz

Download URL meshdb-0.3.0.tar.gz
Size 38.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c36bd9598ee248a23a3587baf92e99d40042168e53d0d22b9eae228c745333a4
BLAKE2b-256 checksum
How to use checksums
6c0089ee2bc5eb09ef9ee23bf65514e117cce7a8382380b6d8e91002494a9613
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 28, 2026.

Transparency log

Release files / meshdb-0.3.0-py3-none-any.whl

Download URL meshdb-0.3.0-py3-none-any.whl
Size 39.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf2bef104ca2f8a06bad69a7ad64e775f33bfd7044b2ac45dd1c45a049eff6d7
BLAKE2b-256 checksum
How to use checksums
4f7891c8e003b68b19edbf1dca79def36764474295206ffaebe1b54325c2ed7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 28, 2026.

Transparency log

Security for meshdb 0.3.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for meshdb-0.3.0.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 Oct 28, 2026.

Transparency log

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