mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-06-28 14:01:21 +02:00
NINA alerts
@sodoku 👀 branch for testing new alerts
This commit is contained in:
+3
-11
@@ -32,25 +32,17 @@ def get_nina_alerts():
|
||||
try:
|
||||
# get api.bund.dev alerts
|
||||
alerts = []
|
||||
|
||||
for regionalKey in myRegionalKeys:
|
||||
|
||||
url = (
|
||||
"https://nina.api.proxy.bund.dev/api31/dashboard/" + regionalKey + ".json"
|
||||
)
|
||||
for regionalKey in myRegionalKeysDE:
|
||||
url = ("https://nina.api.proxy.bund.dev/api31/dashboard/" + regionalKey + ".json")
|
||||
response = requests.get(url)
|
||||
data = response.json()
|
||||
|
||||
|
||||
for item in data:
|
||||
title = item["i18nTitle"]["de"]
|
||||
alerts.append(f"🚨 {title}")
|
||||
|
||||
|
||||
return "\n".join(alerts) if alerts else NO_ALERTS
|
||||
|
||||
except Exception as e:
|
||||
logger.warning("Error getting NINA alerts: " + str(e))
|
||||
logger.warning("Error getting NINA DE alerts: " + str(e))
|
||||
return NO_ALERTS
|
||||
|
||||
def get_wxUKgov():
|
||||
|
||||
+1
-1
@@ -244,7 +244,7 @@ try:
|
||||
enableDEalerts = config['location'].getboolean('enableDEalerts', False) # default False
|
||||
wxAlertsEnabled = config['location'].getboolean('NOAAalertsEnabled', True) # default True
|
||||
mySAME = config['location'].get('mySAME', '').split(',') # default empty
|
||||
myRegionalKeys = config['location'].get('myRegionalKeys', '110000000000').split(',') # default city Berlin
|
||||
myRegionalKeysDE = config['location'].get('myRegionalKeysDE', '110000000000').split(',') # default city Berlin
|
||||
forecastDuration = config['location'].getint('NOAAforecastDuration', 4) # NOAA forcast days
|
||||
numWxAlerts = config['location'].getint('NOAAalertCount', 2) # default 2 alerts
|
||||
enableExtraLocationWx = config['location'].getboolean('enableExtraLocationWx', False) # default False
|
||||
|
||||
Reference in New Issue
Block a user