Thanks to visit codestin.com
Credit goes to github.com

Skip to content

hemna/aprsd-mqtt-plugin

Repository files navigation

APRSD MQTT Plugin

PyPI Status Python Version License

Read the Docs Tests Codecov

pre-commit


Warning

Legal operation of this software requires an amateur radio license and a valid call sign.

Note

Star this repo to follow our progress! This code is under active development, and contributions are both welcomed and appreciated. See CONTRIBUTING.md for details.

Features

The APRSD MQTT Plugin publishes APRS packets to an MQTT broker, allowing you to integrate APRSD with MQTT-based systems. Key features include:

  • MQTT Publishing: Automatically publishes all received APRS packets to a configured MQTT topic
  • JSON Format: Packets are published as JSON for easy consumption by other systems
  • Configurable Broker: Connect to any MQTT broker (local or remote)
  • Authentication Support: Optional username/password authentication for MQTT broker
  • Real-time Integration: Enables real-time APRS data streaming to MQTT subscribers

Requirements

  • aprsd >= 3.0.0
  • A running APRSD instance
  • Access to an MQTT broker (Mosquitto, HiveMQ, EMQX, etc.)

Installation

You can install APRSD MQTT Plugin via pip from PyPI:

$ pip install aprsd-mqtt-plugin

Or using uv:

$ uv pip install aprsd-mqtt-plugin

Configuration

Before using the MQTT plugin, you need to configure it in your APRSD configuration file. Generate a sample configuration file if you haven't already:

$ aprsd sample-config

This will create a configuration file at ~/.config/aprsd/aprsd.conf (or aprsd.yml).

MQTT Plugin Configuration

Add the following section to your APRSD configuration file to configure the MQTT plugin:

[aprsd_mqtt_plugin]
# Enable the MQTT plugin (default: False)
enabled = True

# MQTT broker hostname or IP address (required)
host_ip = localhost

# MQTT broker port (default: 1883)
host_port = 1883

# MQTT topic to publish packets to (default: aprsd/packets)
topic = aprsd/packets

# Optional: MQTT username for authentication
user =

# Optional: MQTT password for authentication
password =

Example Configuration

Here's a complete example configuration:

[aprsd_mqtt_plugin]
enabled = True
host_ip = mqtt.example.com
host_port = 1883
topic = aprsd/packets
user = mqtt_user
password = mqtt_password

Enable the Plugin

To enable the plugin, add it to the enabled_plugins section of your APRSD configuration:

[aprsd]
enabled_plugins = aprsd_mqtt_plugin.aprsd_mqtt_plugin.MQTTPlugin

Usage

Once installed and configured, the MQTT plugin will automatically start when you run aprsd server.

How It Works

The plugin:

  1. Connects to the configured MQTT broker on startup
  2. Subscribes to the configured topic
  3. Publishes all received APRS packets as JSON to the MQTT topic
  4. Maintains a persistent connection to the broker

Packet Format

Packets are published as JSON with the following structure:

{
  "from": "CALLSIGN",
  "to": "DESTINATION",
  "message_text": "Message content",
  "path": ["WIDE1-1", "WIDE2-2"],
  "timestamp": "2024-01-01T12:00:00"
}

Note: Additional fields may be present in the JSON payload.

Verifying It's Working

After starting APRSD, check the logs for messages like:

INFO: Connecting to mqtt://localhost:1883
INFO: Connected to mqtt://localhost:1883/aprsd/packets (0)

You can also subscribe to the MQTT topic using an MQTT client:

$ mosquitto_sub -h localhost -t aprsd/packets

Or using mqtt-cli:

$ mqtt sub -t aprsd/packets

Integration Examples

Home Assistant Integration:

mqtt:
  sensor:
    - name: "APRS Packet"
      state_topic: "aprsd/packets"
      value_template: "{{ value_json.message_text }}"

Node-RED Integration:

Connect an MQTT input node to aprsd/packets and parse the JSON payload.

Custom Application:

Subscribe to the MQTT topic and process the JSON packets in your application.

For more details, see the Command-line Reference.

Contributing

Contributions are very welcome. To learn more, see the Contributor Guide.

License

Distributed under the terms of the Apache Software License 2.0 license, APRSD MQTT Plugin is free and open source software.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Credits

This project was generated from @hemna's APRSD Plugin Python Cookiecutter template.

About

Capture packets and send them all to an mqtt queue

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published