A python package for managing a Meshtastic node database.
Project description
meshdb
A lightweight Python library for storing Meshtastic node, telemetry, and message data in per-node SQLite databases.
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)tcpudpvirtual-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="224.0.0.69",
mcast_port=4403,
),
)
print(conn.transport, conn.owner_node_num)
Optional environment-based shortcut is still available:
export MESHDB_TRANSPORT=udp
export MESHDB_VNODE_ID=!89abcdef
export MESHDB_VNODE_LONG_NAME="MeshDB Virtual Node"
export MESHDB_VNODE_SHORT_NAME=MDB
export MESHDB_MUDP_GROUP=224.0.0.69
export MESHDB_MUDP_PORT=4403
export MESHDB_MUDP_CHANNEL=LongFast
export MESHDB_MUDP_KEY=AQ==
Then call:
conn = meshdb.connect_from_env()
When receiving packets from udp, use meshdb.normalize_packet(packet, "udp")
before passing to meshdb.handle_packet(...).
Viewing Stored Data
You can run:
python -m meshdb --db ./data
This prints a JSON summary of all known nodes and their latest telemetry, if available.
Lookups in Code
import meshdb
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.
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
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 meshdb-0.1.6.tar.gz.
File metadata
- Download URL: meshdb-0.1.6.tar.gz
- Upload date:
- Size: 32.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1969ab1cfd3c078d26d4fcf463f369cfa4c9ab6b0ff61b0f760e88a11b08469a
|
|
| MD5 |
423f55af01219eddf9a75f2a79816bf3
|
|
| BLAKE2b-256 |
c43ef074b686aebb82aaf265a6a3018dce6c6cf01de62ca4f31757ec90bb1471
|
Provenance
The following attestation bundles were made for meshdb-0.1.6.tar.gz:
Publisher:
release.yaml on pdxlocations/meshdb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
meshdb-0.1.6.tar.gz -
Subject digest:
1969ab1cfd3c078d26d4fcf463f369cfa4c9ab6b0ff61b0f760e88a11b08469a - Sigstore transparency entry: 1053976044
- Sigstore integration time:
-
Permalink:
pdxlocations/meshdb@6c67807741aea22cc0b97eed7b4d88922c7fedd9 -
Branch / Tag:
refs/tags/0.1.6 - Owner: https://github.com/pdxlocations
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@6c67807741aea22cc0b97eed7b4d88922c7fedd9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file meshdb-0.1.6-py3-none-any.whl.
File metadata
- Download URL: meshdb-0.1.6-py3-none-any.whl
- Upload date:
- Size: 34.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5d7e236dd606ff63250845e776155f89001afedf08cd4cf29b9df960fa5186a
|
|
| MD5 |
5a5f567b15c8bb3d4d6334a4c28915e9
|
|
| BLAKE2b-256 |
c49777d14cd9644526c63370e447e10a71884503f31c30117d523b1a2d05d514
|
Provenance
The following attestation bundles were made for meshdb-0.1.6-py3-none-any.whl:
Publisher:
release.yaml on pdxlocations/meshdb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
meshdb-0.1.6-py3-none-any.whl -
Subject digest:
f5d7e236dd606ff63250845e776155f89001afedf08cd4cf29b9df960fa5186a - Sigstore transparency entry: 1053976046
- Sigstore integration time:
-
Permalink:
pdxlocations/meshdb@6c67807741aea22cc0b97eed7b4d88922c7fedd9 -
Branch / Tag:
refs/tags/0.1.6 - Owner: https://github.com/pdxlocations
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@6c67807741aea22cc0b97eed7b4d88922c7fedd9 -
Trigger Event:
push
-
Statement type: