Skip to content

Instantly share code, notes, and snippets.

@tomvdb
Created January 8, 2019 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomvdb/7af06a8d63bbead50032b2186864807d to your computer and use it in GitHub Desktop.
Save tomvdb/7af06a8d63bbead50032b2186864807d to your computer and use it in GitHub Desktop.
Simple script that checks the online status of a satnogs station and sends a pushover notification if it's offline, Put in crontab at whatever time interval works for (mine is setup for hourly use)
# simple script that checks the online status of a satnogs station and sends a pushover notification if it's offline
# Put in crontab at whatever time interval works for (mine is setup for hourly use)
# 2019/01/08 - Tom Van den Bon (ZR6TG)
import requests
import httplib, urllib
STATION_ID=62
PUSHOVER_USER_KEY = "USERKEY"
PUSHOVER_API_KEY = "APIKEY"
r = requests.get('https://network.satnogs.org/api/stations/?client_version=&format=json&id=' + str(STATION_ID))
if r.status_code == 200:
data = r.json()
print data
if data[0]["status"] != "Online":
print "Station Offline"
#send pushover message
conn = httplib.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
urllib.urlencode({
"token": PUSHOVER_API_KEY ,
"user": PUSHOVER_USER_KEY,
"message": "Satnogs Station " + str(STATION_ID) + ", " + data[0]["name"] + " is Offline",
}), { "Content-type": "application/x-www-form-urlencoded" })
conn.getresponse()
else:
print "Station Online"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment