From 06a14d875f1cf0fd898aa5e0002be7198837b431 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 18 Dec 2024 19:39:55 -0800 Subject: [PATCH] enableUKalerts --- config.template | 2 +- mesh_bot.py | 12 ++++++------ modules/settings.py | 2 +- modules/system.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/config.template b/config.template index cf36266..27d26bb 100644 --- a/config.template +++ b/config.template @@ -127,7 +127,7 @@ NOAAalertCount = 2 # use Open-Meteo API for weather data not NOAA useful for non US locations UseMeteoWxAPI = False -includeEUalerts = False +enableUKalerts = False # NOAA Hydrology # unique identifiers, LID or USGS ID diff --git a/mesh_bot.py b/mesh_bot.py index 938fb6a..7835531 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -277,10 +277,7 @@ def handle_motd(message, message_from_id, isDM): def handle_wxalert(message_from_id, deviceID, message): if use_meteo_wxApi: - if useEUalerts: - return get_govUK_alerts() - else: - return "wxalert is not supported" + return "wxalert is not supported" else: location = get_node_location(message_from_id, deviceID) if "wxalert" in message: @@ -691,11 +688,14 @@ def handle_wxc(message_from_id, deviceID, cmd): def handle_fema_alerts(message, message_from_id, deviceID): location = get_node_location(message_from_id, deviceID) + if enableUKalerts: + # UK Alerts + return get_govUK_alerts(str(location[0]), str(location[1])) if message.lower().startswith("ealert"): - # Detailed alert + # Detailed alert FEMA return getIpawsAlert(str(location[0]), str(location[1])) else: - # Headlines only + # Headlines only FEMA return getIpawsAlert(str(location[0]), str(location[1]), shortAlerts=True) def handle_bbspost(message, message_from_id, deviceID): diff --git a/modules/settings.py b/modules/settings.py index 5fc62f6..6bb9b80 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -155,7 +155,7 @@ try: latitudeValue = config['location'].getfloat('lat', 48.50) longitudeValue = config['location'].getfloat('lon', -123.0) use_meteo_wxApi = config['location'].getboolean('UseMeteoWxAPI', False) # default False use NOAA - useEUalerts = config['location'].getboolean('includeEUalerts', False) # default False + enableUKalerts = config['location'].getboolean('enableUKalerts', False) # default False use_metric = config['location'].getboolean('useMetric', False) # default Imperial units forecastDuration = config['location'].getint('NOAAforecastDuration', 4) # NOAA forcast days numWxAlerts = config['location'].getint('NOAAalertCount', 2) # default 2 alerts diff --git a/modules/system.py b/modules/system.py index 7dcb4bf..8513578 100644 --- a/modules/system.py +++ b/modules/system.py @@ -74,7 +74,7 @@ if location_enabled: from modules.locationdata import * # from the spudgunman/meshing-around repo trap_list = trap_list + trap_list_location # items tide, whereami, wxc, wx help_message = help_message + ", whereami, wx, wxc, rlist" - if useEUalerts: + if enableUKalerts: from modules.locationdata_eu import * # from the spudgunman/meshing-around repo trap_list = trap_list + trap_list_location_eu #help_message = help_message + ", ukalert, ukwx, ukflood"