GithubHelp home page GithubHelp logo

n8acl / aprsnotify Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 2.0 776 KB

APRS Notification bot for various Social Media Networks

Home Page: https://n8acl.github.io/aprsnotify

License: GNU General Public License v3.0

Python 62.61% HTML 37.39%
aprs-packet bot telegram packet-data twitter mastodon aprs hamradio telegram-bot notification

aprsnotify's Introduction

APRSNotify

Current Release 02032023

Notice 06/09/2024 - As of today, I discovered that the OpenweatherMap API has been updated to v3.0 and the v2.5 will be deprecated this month. This will probably break the script at that point. For the new v3.0 they will continue to let it be free, but they want you to enter a credit card in case you go over the alloted number of calls in the month. This is not ok with me and I will be looking to replace the API with something else. I just found out about this today and I will have an updated version along with other updates to APRSNotify as soon as I can.

APRSNotify is a python based bot script designed to send parsed APRS packet data to various Social Media or Communications networks.

This software is for use by Amateur Radio Operators only.

This bot was designed to be used by one person with multiple APRS Trackers to track packets for that one person. There is the ability to send to club chat servers, but again, each person will need to run their own copy of the script. However, a club hosted version is in the works.

Please see the Wiki for more information and installation and configuration steps as well as running the script.

Working Examples:

Important Note

Due to the announcement that Twitter will be Discontinuing the free developer API on February 9, 2023, as of February 3, 2023 APRSNotify no longer supports Twitter. You will need to update to the current release if you are running APRSNotify to remove the Twitter support if you want to continue using it.

Currently Supported Networks/Functions
Function Supported Services
Position Packet Data
Weather Packet Data
Telegram, Mastodon, Discord, Mattermost, Slack
Message Notification Telegram, Discord, Pushover, Mattermost, Slack
Send Packet Data
to Club Server
Telegram, Discord, Mattermost, Slack

Features

  • Pulls most recent packet data from APRS.fi API for the following types of packets:
    • Position Data
    • Weather Station Data
  • Reverse Geocode with OpenStreetMaps API.
  • Get Weather Conditions from OpenWeatherMaps API for the location of the position packet
  • Find Maidenhead Grid Square of packet location.
  • Send Status to Social Media Networks (See above for supported Networks)
  • Get notification of an APRS message sent to your station (see above for supported Networks). If someone sends a message via APRS to one of the callsigns being tracked, the script will notify you and share the message with you.
  • Send packet data to a club Server channel. This allows club members to share packet data information with each other.

Use Cases

  • Sending an APRS Position packet to Social Media for your followers to see.
  • Sending Weather data from APRS to Social Media.
  • Sending APRS data to yourself to confirm that it is making it to the internet.
  • Sending your position information to a Telegram/Discord/Mattermost/Slack Channel that you have your non-ham radio family and friends on so they can track you when you are traveling by car for a long distance.
  • Participating in sending packet data to a club server/channel in addition to your own channels/servers
  • Other uses that your imagination comes up with.

UPGRADE TO RELEASE 02032023

Normal Upgrade

To upgrade to the current version of the script, enter the folder where you have the APRSNotify scrpts and do a git pull -ff to get the newest updated scripts. Then please run the update.py python3 update.py script. It will update your database to the most current version.

If you are installing the whole script for the first time (i.e. have never used APRSNotify before), please run an_util.py instead. Only run the upgrade script if you have used APRSNotify before and have previously upgraded to version 4.

Upgrading a version older than Version 4 to current version

Please note that any version prior to 4 has had to be depreciated and is no longer supported. With all the changes, it is difficult to support those older versions with the new version.

The easiest way to upgrade a version of APRSNotify that is older than Version 4 is to make sure to backup the config.py file to another location and then deleting the old APRSnotify script folder. Then clone the repo to get the latest script files. This allows you to setup the script as basically a brand new setup, just follow the directions in the wiki for a new setup and using the an_util.py file. You can use your old config.py file as reference to copy and paste your keys and things in as needed.


Credits

The Original Telegram Notify bot functionality was based off a gist by Github user Lucaspg96. Click Here.

Adding Grid Square to Status message was suggested by Alex, N7AGF.

The Grid Square Function was developed by Walter Underwood, K6WRU and posted on ham.stackexchange.com. Click Here

The map image functionality for the Telegram Bot and suggestions to include or not include Weather data among other suggestions were contributed by Chanyeol Yoo, Ph.D., VK2FAED

APRS.FI API Limitations issues found and troubleshot by Alex Bowman, KN4KNG.

Installation of the Verison 4 scripts troubleshot by Diego, EA3ICN.

Pushover Notification API mechanics from Micheal Clemens, DL6MHC

APRS and the APRS System and associated copyright were developed by Bob Bruninga, WB4APR (SK) http://www.aprs.org.


Contact

If you have questions, please feel free to reach out to me. You can reach me in one of the following ways:

Or open an issue on Github. I will respond to it, and of course you, when I can. Remember, this is a hobby and there are other daily distractors that come first, like work, school and family.

If you reach out to me and have an error, please include what error you are getting and what you were doing. I may also ask you to send me certain files to look at. Otherwise just reach out to me :).


Change Log

Changes Prior to current year have been moved to the ChangeLog on the wiki.

  • 02/03/2023

    • Removed support for Twitter from the script.
    • Updated the Wiki to reflect current changes to the script.
  • 01/24/2023 - Minor Update

    • Put the flask package back in the requirements.txt file. Accidently deleted it and did not realize it. (Thanks to Russ, KV4S for catching this one.)

aprsnotify's People

Contributors

dc7ia avatar n8acl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

kn4kng igorrecioh

aprsnotify's Issues

Line 251 in aprsnotify.py seems to be not needed.

aprsnotify.py successfully sends latest data and msgs, but errors out at the end.

Traceback (most recent call last):
File "aprsnotify.py", line 251, in
chks["lastmsgid"] = lastmsgid
NameError: name 'lastmsgid' is not defined

It appears the lastmsgid is defined and used outside of conditional statement and not needed in this section. commenting out solves the error. Not sure if something past this point is needed or not.

    if gooddata == 1: # If we have good msg data
        # create msg status and send to Telegram
        msg_status = srccall + " sent you the following message on APRS: " + msg
        tele_bot_message(msg_status)

#        chks["lastmsgid"] = lastmsgid

Running an_util.py: sqlite3.OperationalError

Hi, thank you for your work!

I'm trying to setup aprsnotify for the first time.

root@raspberry:/opt/aprsnotify# python3 an_util.py 
Traceback (most recent call last):
  File "an_util.py", line 157, in <module>
    new(conn, current_version)
  File "an_util.py", line 127, in new
    exec_sql(conn,sql)
  File "an_util.py", line 33, in exec_sql
    cur.execute(sql)
sqlite3.OperationalError: 18 values for 19 columns

aprsnotify.py unable to pull latest message from multiple SSIDs

As per issue #2 aprsnotify.py is only able to pull messages from one SSID.

The msg function seems to only work with one SSID. To test I sent a message to KN4KNG-14 and created another file reqtest.py:

#!/usr/bin/python3
import requests
url = 'https://api.aprs.fi/api/get'
locpayload = {'name': 'KN4KNG-1,KN4KNG-2,KN4KNG-3,KN4KNG-4,KN4KNG-5,KN4KNG-6,KN4KNG-7,KN4KNG-8,KN4KNG-9,KN4KNG-10,KN4KNG-11,KN4KNG-12,KN4KNG-13,KN4KNG-14,KN4KNG-15', 'what': 'loc', 'apikey': '<KEY>', 'format': 'json'}
loc = requests.get(url, params=locpayload)
print(loc.text)
msgspayload = {'what': 'msg', 'dst': 'KN4KNG-1,KN4KNG-2,KN4KNG-3,KN4KNG-4,KN4KNG-5,KN4KNG-6,KN4KNG-7,KN4KNG-8,KN4KNG-9,KN4KNG-10,KN4KNG-11,KN4KNG-12,KN4KNG-13,KN4KNG-14,KN4KNG-15', 'apikey': '<KEY>', 'format': 'json'}
msgs = requests.get(url, params=msgspayload)
print(msgs.text)

and I get the following output:

pi@raspberrypi:~ $ ./reqtest.py
{"command":"get","result":"ok","what":"loc","found":1,"entries":[{"class":"a","name":"KN4KNG-14","type":"l","time":"1607538117","lasttime":"1607538117","lat":"36.42617","lng":"-78.47717","course":13,"speed":0,"symbol":"\/$","srccall":"KN4KNG-14","dstcall":"","comment":"A=449APRSpro for iPhone 3.29V@48% hE<14m Oxford","path":"TCPIP*,qAC,KN4KNG-14"}]}
{"command":"get","result":"ok","found":0,"what":"msg","entries":[]}

I then sent a msg to both KN4KNG-14 & KN4KNG-1 and changed SSID Order to KN4KNG-14 in place of KN4KNG-1:

#!/usr/bin/python3
import requests
url = 'https://api.aprs.fi/api/get'
locpayload = {'name': 'KN4KNG-1,KN4KNG-2,KN4KNG-3,KN4KNG-4,KN4KNG-5,KN4KNG-6,KN4KNG-7,KN4KNG-8,KN4KNG-9,KN4KNG-10,KN4KNG-11,KN4KNG-12,KN4KNG-13,KN4KNG-14,KN4KNG-15', 'what': 'loc', 'apikey': '<KEY>', 'format': 'json'}
loc = requests.get(url, params=locpayload)
print(loc.text)
msgspayload = {'what': 'msg', 'dst': 'KN4KNG-14,KN4KNG-2,KN4KNG-3,KN4KNG-4,KN4KNG-5,KN4KNG-6,KN4KNG-7,KN4KNG-8,KN4KNG-9,KN4KNG-10,KN4KNG-11,KN4KNG-12,KN4KNG-13,KN4KNG-1,KN4KNG-15', 'apikey': '<KEY>', 'format': 'json'}
msgs = requests.get(url, params=msgspayload)
print(msgs.text)

and I get the following output:

pi@raspberrypi:~ $ ./reqtest.py
{"command":"get","result":"ok","what":"loc","found":1,"entries":[{"class":"a","name":"KN4KNG-14","type":"l","time":"1607538117","lasttime":"1607538117","lat":"36.42617","lng":"-78.47717","course":13,"speed":0,"symbol":"\/$","srccall":"KN4KNG-14","dstcall":"","comment":"A=449APRSpro for iPhone 3.29V@48% hE<14m Oxford","path":"TCPIP*,qAC,KN4KNG-14"}]}
{"command":"get","result":"ok","found":1,"what":"msg","entries":[{"messageid":"59834024","time":"1607532269","srccall":"KN4KNG","dst":"KN4KNG-14","message":"Testing APRS"}]}

New VM Install - error around idna and doesn't appear to run flask at the end

Attempting to install on:

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=Debian

output window:

root@kv4s:/home/kv4s/aprsnotify# pip3 install -r requirements.txt Collecting python-telegram-bot (from -r requirements.txt (line 1)) Downloading https://files.pythonhosted.org/packages/75/30/6e63bd6686d83cfd0e2f22f05cfc411571cf7934d72b62636e4bee0dd91f/python_telegram_bot-20.0-py3-none-any.whl (484kB) 100% |████████████████████████████████| 491kB 2.2MB/s Collecting Tweepy (from -r requirements.txt (line 2)) Downloading https://files.pythonhosted.org/packages/ad/62/35e988300d82513fb5e1168108d879a5462072ce1d5137816f91a674df7e/tweepy-4.12.1-py3-none-any.whl (101kB) 100% |████████████████████████████████| 102kB 4.8MB/s Collecting geopy (from -r requirements.txt (line 3)) Downloading https://files.pythonhosted.org/packages/e4/00/6313c0ffdd230164890f433019749189e0b884562bdc170e9c3a3454b3a6/geopy-2.3.0-py3-none-any.whl (119kB) 100% |████████████████████████████████| 122kB 5.8MB/s Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from -r requirements.txt (line 4)) (2.21.0) Collecting aprslib (from -r requirements.txt (line 5)) Downloading https://files.pythonhosted.org/packages/d7/b4/4b82e41dc007cfa68ee076ef905b823f841e4ce868fe7ee8b22cfe26796a/aprslib-0.7.2-py2.py3-none-any.whl (44kB) 100% |████████████████████████████████| 51kB 7.9MB/s Collecting mastodon.py (from -r requirements.txt (line 6)) Downloading https://files.pythonhosted.org/packages/08/9b/1e3a058da4ce91bb1ebe4a025d56e9cd774461f924ea2a87c2049ad2ac98/Mastodon.py-1.8.0-py2.py3-none-any.whl (64kB) 100% |████████████████████████████████| 71kB 6.9MB/s Collecting discord_webhook (from -r requirements.txt (line 7)) Downloading https://files.pythonhosted.org/packages/3b/85/ad722bb6083ba67bdf1fae93a244ea574eead8be147aaed9503984d62d5e/discord_webhook-0.17.0-py3-none-any.whl Collecting matterhook (from -r requirements.txt (line 8)) Downloading https://files.pythonhosted.org/packages/7a/07/c69624a4e1cc08ca0bb61da314c25ed0d39c1be3bbf452a810ae20d9d538/matterhook-0.2.tar.gz Collecting httpx~=0.23.1 (from python-telegram-bot->-r requirements.txt (line 1)) Downloading https://files.pythonhosted.org/packages/ac/a2/0260c0f5d73bdf06e8d3fc1013a82b9f0633dc21750c9e3f3cb1dba7bb8c/httpx-0.23.3-py3-none-any.whl (71kB) 100% |████████████████████████████████| 71kB 4.0MB/s Collecting oauthlib<4,>=3.2.0 (from Tweepy->-r requirements.txt (line 2)) Downloading https://files.pythonhosted.org/packages/7e/80/cab10959dc1faead58dc8384a781dfbf93cb4d33d50988f7a69f1b7c9bbe/oauthlib-3.2.2-py3-none-any.whl (151kB) 100% |████████████████████████████████| 153kB 4.9MB/s Collecting requests-oauthlib<2,>=1.2.0 (from Tweepy->-r requirements.txt (line 2)) Downloading https://files.pythonhosted.org/packages/6f/bb/5deac77a9af870143c684ab46a7934038a53eb4aa975bc0687ed6ca2c610/requests_oauthlib-1.3.1-py2.py3-none-any.whl Collecting geographiclib<3,>=1.52 (from geopy->-r requirements.txt (line 3)) Downloading https://files.pythonhosted.org/packages/9f/5a/a26132406f1f40cf51ea349a5f11b0a46cec02a2031ff82e391c2537247a/geographiclib-2.0-py3-none-any.whl (40kB) 100% |████████████████████████████████| 40kB 6.6MB/s Collecting blurhash>=1.1.4 (from mastodon.py->-r requirements.txt (line 6)) Downloading https://files.pythonhosted.org/packages/80/08/163cb166a2464223a5eb8890a92cc1cf7e8c7c79a2c75e497e3d8f3a4711/blurhash-1.1.4-py2.py3-none-any.whl Collecting python-dateutil (from mastodon.py->-r requirements.txt (line 6)) Downloading https://files.pythonhosted.org/packages/36/7a/87837f39d0296e723bb9b62bbb257d0355c7f6128853c78955f57342a56d/python_dateutil-2.8.2-py2.py3-none-any.whl (247kB) 100% |████████████████████████████████| 256kB 2.8MB/s Requirement already satisfied: six in /usr/lib/python3/dist-packages (from mastodon.py->-r requirements.txt (line 6)) (1.12.0) Collecting decorator>=4.0.0 (from mastodon.py->-r requirements.txt (line 6)) Downloading https://files.pythonhosted.org/packages/d5/50/83c593b07763e1161326b3b8c6686f0f4b0f24d5526546bee538c89837d6/decorator-5.1.1-py3-none-any.whl Collecting python-magic (from mastodon.py->-r requirements.txt (line 6)) Downloading https://files.pythonhosted.org/packages/6c/73/9f872cb81fc5c3bb48f7227872c28975f998f3e7c2b1c16e95e6432bbb90/python_magic-0.4.27-py2.py3-none-any.whl Collecting rfc3986[idna2008]<2,>=1.3 (from httpx~=0.23.1->python-telegram-bot->-r requirements.txt (line 1)) Downloading https://files.pythonhosted.org/packages/c4/e5/63ca2c4edf4e00657584608bee1001302bbf8c5f569340b78304f2f446cb/rfc3986-1.5.0-py2.py3-none-any.whl Collecting httpcore<0.17.0,>=0.15.0 (from httpx~=0.23.1->python-telegram-bot->-r requirements.txt (line 1)) Downloading https://files.pythonhosted.org/packages/04/7e/ef97af4623024e8159993b3114ce208de4f677098ae058ec5882a1bf7605/httpcore-0.16.3-py3-none-any.whl (69kB) 100% |████████████████████████████████| 71kB 6.5MB/s Requirement already satisfied: certifi in /usr/lib/python3/dist-packages (from httpx~=0.23.1->python-telegram-bot->-r requirements.txt (line 1)) (2018.8.24) Collecting sniffio (from httpx~=0.23.1->python-telegram-bot->-r requirements.txt (line 1)) Downloading https://files.pythonhosted.org/packages/c3/a0/5dba8ed157b0136607c7f2151db695885606968d1fae123dc3391e0cfdbf/sniffio-1.3.0-py3-none-any.whl Requirement already satisfied: idna; extra == "idna2008" in /usr/lib/python3/dist-packages (from rfc3986[idna2008]<2,>=1.3->httpx~=0.23.1->python-telegram-bot->-r requirements.txt (line 1)) (2.6) Collecting anyio<5.0,>=3.0 (from httpcore<0.17.0,>=0.15.0->httpx~=0.23.1->python-telegram-bot->-r requirements.txt (line 1)) Downloading https://files.pythonhosted.org/packages/77/2b/b4c0b7a3f3d61adb1a1e0b78f90a94e2b6162a043880704b7437ef297cad/anyio-3.6.2-py3-none-any.whl (80kB) 100% |████████████████████████████████| 81kB 5.6MB/s Collecting h11<0.15,>=0.13 (from httpcore<0.17.0,>=0.15.0->httpx~=0.23.1->python-telegram-bot->-r requirements.txt (line 1)) Downloading https://files.pythonhosted.org/packages/95/04/ff642e65ad6b90db43e668d70ffb6736436c7ce41fcc549f4e9472234127/h11-0.14.0-py3-none-any.whl (58kB) 100% |████████████████████████████████| 61kB 6.6MB/s Collecting typing-extensions; python_version < "3.8" (from anyio<5.0,>=3.0->httpcore<0.17.0,>=0.15.0->httpx~=0.23.1->python-telegram-bot->-r requirements.txt (line 1)) Downloading https://files.pythonhosted.org/packages/0b/8e/f1a0a5a76cfef77e1eb6004cb49e5f8d72634da638420b9ea492ce8305e8/typing_extensions-4.4.0-py3-none-any.whl Building wheels for collected packages: matterhook Running setup.py bdist_wheel for matterhook ... done Stored in directory: /root/.cache/pip/wheels/f0/66/f0/ab0d427b2d303a96079fe403e00adb96e27128bbc7a6379ae7 Successfully built matterhook anyio 3.6.2 has requirement idna>=2.8, but you'll have idna 2.6 which is incompatible. tweepy 4.12.1 has requirement requests<3,>=2.27.0, but you'll have requests 2.21.0 which is incompatible. Installing collected packages: rfc3986, sniffio, typing-extensions, anyio, h11, httpcore, httpx, python-telegram-bot, oauthlib, requests-oauthlib, Tweepy, geographiclib, geopy, aprslib, blurhash, python-dateutil, decorator, python-magic, mastodon.py, discord-webhook, matterhook Successfully installed Tweepy-4.12.1 anyio-3.6.2 aprslib-0.7.2 blurhash-1.1.4 decorator-5.1.1 discord-webhook-0.17.0 geographiclib-2.0 geopy-2.3.0 h11-0.14.0 httpcore-0.16.3 httpx-0.23.3 mastodon.py-1.8.0 matterhook-0.2 oauthlib-3.2.2 python-dateutil-2.8.2 python-magic-0.4.27 python-telegram-bot-20.0 requests-oauthlib-1.3.1 rfc3986-1.5.0 sniffio-1.3.0 typing-extensions-4.4.0 root@kv4s:/home/kv4s/aprsnotify# python3 an_util.py Traceback (most recent call last): File "an_util.py", line 2, in <module> from flask import Flask, render_template, request, Markup ModuleNotFoundError: No module named 'flask'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.