marcel
f0fe632cae
|
11 months ago | |
---|---|---|
python-ax25 | 2 years ago | |
CHANGELOG.md | 11 months ago | |
README.md | 1 year ago | |
aprs-mqtt-bridge.py | 11 months ago | |
aprs-mqtt-bridge.yml | 1 year ago |
README.md
APRS to MQTT bridge
The APRS to MQTT bridge can relay commands from an MQTT broker to the APRS nodes via the Linux AX.25 stack. For now, only commands which response with a defined acknowledge (commands 10 and higher) are supported.
This program is a utility for the APRS telemetry system used by PE1RXF. The telemetry is embedded in an APRS message which can travel over the existing APRS network. For more information about this open protocol visit this link: https://www.meezenest.nl/mees-elektronica/projects/aprs_telemetry/APRS_protocol_nodes_PE1RXF.pdf
Configuration
The program is configured via a YAML file. The global section defines the MQTT broker and some APRS transmit settings. The topics define the MQTT topics on which a client can publish a request. The full path of the topic is 'topic_root/topic_name'. Call, server and port define the AX.25 settings where 'call' is the call of the APRS node the message is send to, 'server' is the call of the APRS server which sends the message (typically this is the call assigned to the ax25 port) and 'port' is the Linux AX.25 port on which the radio is connected.
Lets say we have an APRS node which can switch several power rails. (https://www.meezenest.nl/mees-elektronica/RPi-pico-LoRa-APRS.html). We connected a 5GHz HamNet dish to output 2 of this APRS node. The node is assigned the call 'PE1RXF-6'. Assume this node can be reached via the radio connected to AX.25 port ax2 on our server. The node switches the output to high when it receives command '33{33'. We want the bridge to send this command when it receives payload 'ON' via MQTT on topic 'hamnet_aprs_nodes/ubiquity_dish_ptmp_workshop'. With the below example configuration, we can achieve just that. And by sending MQTT payload 'OFF', the APRS node switches the ouptut off again.
Multiple topics for the same or another APRS node can be defined as shown in the example.
# Global settings apply to all other entries
global:
broker: pe1rxf.ampr.org # The MQTT broker we are going to use
port: 1883 # The tcp port of the MQTT broker
topic_root: hamnet_aprs_nodes # MQTT topic root
transmit_rate: 20 # Number of seconds between each transmision
retry: 3 # Try this often before giving up
destination: APRX29 # Destination or program ID
digi_path: WIDE2-1 # Digi path of APRS messages
poll_rate: 300 # Number of second between polling
#beacon_program: /usr/sbin/beacon # The external AX.25 beacon program => obsolete
# Poll the status af these clients (IMPORTANT: the calls must also be defined in the topics section)
poll:
- call: PE1RXF-5
- call: PE1RXF-6
- call: PE1RXF-8
topics:
# MQTT topic: 5GHz dish at workshop (must be unique name)
- name: ubiquity_dish_ptmp_workshop
call: PE1RXF-6 # Call of node to which commands below are send
server: PE1RXF-3 # Call of APRS server sending the commands
port: ax2 # Name of AX.25 port to use
command:
- payload: 'ON' # This is the payload we have to receive
cmd: 33{33 # This command is send to the node
response: ack33 # This response is expected from the node
- payload: 'OFF'
cmd: 32{32
response: ack32
# Server at tiny house
- name: server_tiny_house
call: PE1RXF-7
server: PE1RXF-3
port: ax2
command:
- payload: 'ON'
cmd: 31{31
response: ack31
- payload: 'OFF'
cmd: 30{30
response: ack30
The configuration entry 'global:retry' sets the amount of APRS message retries we attempt before giving up. The configuration entry 'global:transmit_rate' sets the time between retries.
When a node is added to the poll: call: entry its status will be polled on a regular base. The poll rate is set in the global entry. This is the poll interval between every transmision. When three nodes are defined, a node is polled every 3*poll_rate seconds.
Requirements
- Python3
- Python AX.25 Module for Python3 (https://github.com/ha5di/pyax25)
- pathlib
- yaml
- paho-mqtt
- Linux AX.25 stack