Skip to main content

A library for Meshtastic communication over UDP.

Project description

This library provides UDP-based broadcasting of Meshtastic-compatible packets.

Installation

pip install mudp

Command Line

To view all Meshtastic udp activity on your LAN:

mudp

PubSub RX Topics

When using this library as a listener, it can publish received packets to the Python pubsub system. The following topics are available:

  • mesh.rx.raw – publishes (data, addr) with the raw UDP packet bytes and source address tuple.
  • mesh.rx.decode_error – publishes (addr) when a packet fails to decode.
  • mesh.rx.packet – publishes (packet, addr) for all successfully parsed MeshPacket objects.
  • mesh.rx.decoded – publishes (packet, portnum, addr) when the decoded portion is available.
  • mesh.rx.port.<portnum> – publishes (packet, addr) for filtering by port number.

Send Functions (see examples for further information):

from mudp import (
    conn,
    node,
    send_nodeinfo,
    send_text_message,
    send_device_telemetry,
    send_position,
    send_environment_metrics,
    send_power_metrics,
)

MCAST_GRP = "224.0.0.69"
MCAST_PORT = 4403

node.node_id = "!deadbeef"
node.long_name = "UDP Test"
node.short_name = "UDP"
node.channel = "LongFast"
node.key = "1PG7OiApB1nwvP+rz05pAQ=="
conn.setup_multicast(MCAST_GRP, MCAST_PORT)

send_nodeinfo(keys=values...)
send_device_telemetry(keys=values...)
send_position(latitude, longitude, keys=values...)
send_environment_metrics(keys=values...)
send_power_metrics(keys=values...)
send_health_metrics(keys=values...)
send_text_message("text", keys=values...)

Optional Arguments for all message types:

  • to=INT
  • hop_limit=INT
  • hop_start=INT
  • want_ack=BOOL
  • want_response=BOOL

Example:

send_text_message("Happy New Year" to=12345678, hop_limit=5)

Supported keyword arguments for nodeinfo:

  • node_id
  • long_name
  • short_name
  • hw_model
  • is_licensed
  • role
  • public_key

Supported keyword arguments for device metrics:

  • battery_level
  • voltage
  • channel_utilization
  • air_util_tx
  • uptime_seconds

Supported keyword arguments for position metrics:

  • latitude (required)
  • longitude (required)
  • latitude_i
  • longitude_i
  • altitude
  • precision_bits
  • HDOP
  • PDOP
  • VDOP
  • altitude_geoidal_separation
  • altitude_hae
  • altitude_source
  • fix_quality
  • fix_type
  • gps_accuracy
  • ground_speed
  • ground_track
  • next_update
  • sats_in_view
  • sensor_id
  • seq_number
  • timestamp
  • timestamp_millis_adjust

Supported keyword arguments for environment metrics:

  • temperature
  • relative_humidity
  • barometric_pressure
  • gas_resistance
  • voltage
  • current
  • iaq
  • distance
  • ir_lux
  • lux
  • radiation
  • rainfall_1h
  • rainfall_24h
  • soil_moisture
  • soil_temperature
  • uv_lux
  • weight
  • white_lux
  • wind_direction
  • wind_gust
  • wind_lull
  • wind_speed

Supported keyword arguments for power metrics:

  • ch1_voltage
  • ch1_current
  • ch2_voltage
  • ch2_current
  • ch3_voltage
  • ch3_current

Supported keyword arguments for health metrics:

  • heart_bpm
  • spO2
  • temperature

Install in development (editable) mode:

python3 -m venv .venv
source .venv/bin/activate
pip install -e .

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

mudp-1.0.0a6.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

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

mudp-1.0.0a6-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file mudp-1.0.0a6.tar.gz.

File metadata

  • Download URL: mudp-1.0.0a6.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mudp-1.0.0a6.tar.gz
Algorithm Hash digest
SHA256 7c155487b55045480ff130d0d0d6fabd43e276a554c77f32295844bc3a2b661e
MD5 aa5fc39a69b489dd0bcd7310321423b0
BLAKE2b-256 896fb77a5547f8e76f8dabce3e16361a765fc13941b7fbd11cbd66a868ca739d

See more details on using hashes here.

Provenance

The following attestation bundles were made for mudp-1.0.0a6.tar.gz:

Publisher: release.yaml on pdxlocations/mudp

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

File details

Details for the file mudp-1.0.0a6-py3-none-any.whl.

File metadata

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

File hashes

Hashes for mudp-1.0.0a6-py3-none-any.whl
Algorithm Hash digest
SHA256 3bd88f5381f563570ed77b44ce19bdb23f84401469206406be70a1dd87496201
MD5 3e2d477329b162b1ef971e6f36b9a165
BLAKE2b-256 adf989d21a69bdbc97de2d86b59f9bce172b4fc94fcf9d9c7308e93390538f29

See more details on using hashes here.

Provenance

The following attestation bundles were made for mudp-1.0.0a6-py3-none-any.whl:

Publisher: release.yaml on pdxlocations/mudp

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