ealert FEMA alerting

this code is still very early
This commit is contained in:
SpudGunMan
2024-12-10 17:48:40 -08:00
parent 53adb4be70
commit daf43f306b
3 changed files with 8 additions and 3 deletions

View File

@@ -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]

View File

@@ -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:

View File

@@ -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: