diff --git a/mesh_bot.py b/mesh_bot.py index 2faf770..1fabe5f 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -73,6 +73,7 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n "testing": lambda: handle_ping(message_from_id, deviceID, message, hop, snr, rssi, isDM, channel_number), "tide": lambda: handle_tide(message_from_id, deviceID, channel_number), "videopoker": lambda: handleVideoPoker(message, message_from_id, deviceID), + "ealert": lambda: handle_fema_alerts(message, message_from_id, deviceID), "whereami": lambda: handle_whereami(message_from_id, deviceID, channel_number), "whoami": lambda: handle_whoami(message_from_id, deviceID, hop, snr, rssi, pkiStatus), "wiki:": lambda: handle_wiki(message, isDM), @@ -615,6 +616,10 @@ def handle_wxc(message_from_id, deviceID, cmd): weather = get_weather(str(location[0]), str(location[1])) return weather +def handle_fema_alerts(message, message_from_id, deviceID): + location = get_node_location(message_from_id, deviceID) + return getIpawsAlert(str(location[0]), str(location[1])) + def handle_bbspost(message, message_from_id, deviceID): if "$" in message and not "example:" in message: subject = message.split("$")[1].split("#")[0] diff --git a/modules/locationdata.py b/modules/locationdata.py index d16d8fd..8d191cb 100644 --- a/modules/locationdata.py +++ b/modules/locationdata.py @@ -9,7 +9,7 @@ import bs4 as bs # pip install beautifulsoup4 import xml.dom.minidom from modules.log import * -trap_list_location = ("whereami", "tide", "moon", "wx", "wxc", "wxa", "wxalert", "rlist") +trap_list_location = ("whereami", "tide", "moon", "wx", "wxc", "wxa", "wxalert", "rlist", "ealert") def where_am_i(lat=0, lon=0, short=False, zip=False): whereIam = "" @@ -522,7 +522,7 @@ def getIpawsAlert(lat=0, lon=0): # return the numWxAlerts of alerts if len(alerts) > 0: for alertItem in alerts[:numWxAlerts]: - alert += abbreviate_noaa(f"🚨 FEMA Alert: {alertItem['headline']}\n{alertItem['description']}") + alert += abbreviate_noaa(f"🚨FEMA Alert: {alertItem['headline']}\n{alertItem['description']}") if alertItem != alerts[:numWxAlerts][-1]: alert += "\n" else: diff --git a/modules/system.py b/modules/system.py index 2bbe7b0..f71bb68 100644 --- a/modules/system.py +++ b/modules/system.py @@ -72,7 +72,7 @@ if enableCmdHistory: 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" + help_message = help_message + ", whereami, wx, wxc, rlist, ealert" # Open-Meteo Configuration for worldwide weather if use_meteo_wxApi: