APRS to Mastodon - M0YNG.uk
Created 2020-08-08
- Amateur Radio
- APRS
- Mastodon
Who doesn't want to post messages to a social network using APRS?
It's an idea I've been not-really working on for a while, and I've had various iterations.
One would watch the log files of `APRX` and toot weather reports heard off the air.
This one connects to the APRS Internet Stream and lets people send an APRS message to `M0YNG-15`, then have it tooted by @APRSBot[1] (it toots "Followers only" so it might appear silent.)
The code is fairly simple, and almost certainly has issues!
The Code
publicTooter.py
#!/usr/bin/env python3
"""
APRS -> Fediverse gateway
Maybe.
M0YNG 2020
"""
# imports (obviously)
import aprslib
import configparser
from mastodon import Mastodon
# Load the config
config = configparser.ConfigParser()
config.read('config.ini')
# hashes of already tooted messages
pastToots = []
# connect to mastodon
mastodonBot = Mastodon(
access_token=config['mastodon']['access_token'],
api_base_url=config['mastodon']['app_url']
)
# function to check and toot APRS packets
def callback(packet):
if 'addresse' in packet and packet['addresse'] == config['aprs']['callsign'] and packet['format'] == 'message':
# Construct toot text
tootText = 'From ' + str(packet['from']) + ' via ' + \
str(packet['path']) + '\n\n' + packet['message_text']
tootHash = hash(tootText)
if tootHash not in pastToots:
# log it
print(tootText)
# toot it
postedToot = mastodonBot.status_post(tootText)
# log it
print(postedToot['url'] + '\n')
# record it
pastToots.append(tootHash)
# let the user know it worked
AIS.sendall(config['aprs']['callsign'] +
'>APRS,TCPIP*::'+str(packet['from']) + ' : Message tooted!')
else:
print('Already tooted this message')
# connect to the stream
AIS = aprslib.IS(config['aprs']['callsign'], passwd=config['aprs']['passcode'])
AIS.connect()
# do something with each packet
AIS.consumer(callback)
config.ini
[mastodon] access_token = youraccesstoken app_url = https://your.domain.here [aprs] callsign = callsign-ssid passcode = passcodde
The Future
Things this could do;
- Have "registered users" who's messages could be tooted by specific accounts, e.g. if it comes from `M0YNG` it gets tooted by `@M0YNG-APRS`
- Be used at a hamfest or club event, and display the messages somewhere fun
-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-
🖤 Black Lives Matter
💙🤍💜 Trans Rights are Human Rights
❤️🧡💛💚💙💜 Love is Love
Copyright © 2025 Christopher M0YNG - It is forbidden to use any part of this site for crypto/NFT/AI related projects.
Page generated 2025-08-07 by Complex 19