diff --git a/config.template b/config.template index 46994d8..93784e8 100644 --- a/config.template +++ b/config.template @@ -108,33 +108,6 @@ bbslink_enabled = False # list of whitelisted nodes numbers ex: 2813308004,4258675309 empty list allows all bbslink_whitelist = -[smtp] -# enable or disable the SMTP module -enableSMTP = False -# enable or disable the IMAP module for inbound email -enableImap = False -# list of Sysop Emails seperate with commas -sysopEmails = -SMTP_SERVER = smtp.gmail.com -# 587 SMTP over TLS/STARTTLS, 25 legacy SMTP, 465 SMTP over SSL -SMTP_PORT = 587 -# Sender email: be mindful of public access, don't use your personal email -FROM_EMAIL = none@gmail.com -SMTP_AUTH = True -SMTP_USERNAME = none@gmail.com -SMTP_PASSWORD = none -EMAIL_SUBJECT = Meshtastic✉️ - -# IMAP not implimented yet -IMAP_SERVER = imap.gmail.com -# 993 IMAP over TLS/SSL, 143 legacy IMAP -IMAP_PORT = 993 -# IMAP login usually same as SMTP -IMAP_USERNAME = none@gmail.com -IMAP_PASSWORD = none -IMAP_FOLDER = inbox - - # location module [location] enabled = True @@ -154,6 +127,10 @@ NOAAalertCount = 2 # use Open-Meteo API for weather data not NOAA useful for non US locations UseMeteoWxAPI = False +# NOAA Hydrology +# unique identifiers, LID or USGS ID +riverListDefault = + # EAS Alert Broadcast wxAlertBroadcastEnabled = False # EAS Alert Broadcast Channels @@ -209,6 +186,32 @@ broadcastCh = 2 enable_read_news = False news_file_path = news.txt +[smtp] +# enable or disable the SMTP module +enableSMTP = False +# enable or disable the IMAP module for inbound email +enableImap = False +# list of Sysop Emails seperate with commas +sysopEmails = +SMTP_SERVER = smtp.gmail.com +# 587 SMTP over TLS/STARTTLS, 25 legacy SMTP, 465 SMTP over SSL +SMTP_PORT = 587 +# Sender email: be mindful of public access, don't use your personal email +FROM_EMAIL = none@gmail.com +SMTP_AUTH = True +SMTP_USERNAME = none@gmail.com +SMTP_PASSWORD = none +EMAIL_SUBJECT = Meshtastic✉️ + +# IMAP not implimented yet +IMAP_SERVER = imap.gmail.com +# 993 IMAP over TLS/SSL, 143 legacy IMAP +IMAP_PORT = 993 +# IMAP login usually same as SMTP +IMAP_USERNAME = none@gmail.com +IMAP_PASSWORD = none +IMAP_FOLDER = inbox + [games] # if hop limit for the user exceeds this value, the message will be dropped game_hop_limit = 5 diff --git a/mesh_bot.py b/mesh_bot.py index 3d72720..3071eee 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -62,6 +62,7 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n "pinging": lambda: handle_ping(message_from_id, deviceID, message, hop, snr, rssi, isDM, channel_number), "pong": lambda: "🏓PING!!🛜", "readnews": lambda: read_news(), + "riverflow": lambda: handle_riverFlow(message, message_from_id, deviceID), "rlist": lambda: handle_repeaterQuery(message_from_id, deviceID, channel_number), "satpass": lambda: handle_satpass(message_from_id, deviceID, channel_number, message), "setemail": lambda: handle_email(message_from_id, message), @@ -645,6 +646,27 @@ def handleGolf(message, nodeID, deviceID): time.sleep(responseDelay + 1) return msg +def handle_riverFlow(message, message_from_id, deviceID): + location = get_node_location(message_from_id, deviceID) + if "riverflow " in message.lower(): + userRiver = message.split("userriver ")[1] + else: + # if riverListDefault has multiple pass on if just one river clean up + if "," in riverListDefault: + riverList = riverListDefault.split(",") + userRiver = riverList[0].strip() + else: + userRiver = riverListDefault + + # return river flow data + if use_meteo_wxApi: + return get_flood_openmeteo(location[0], location[1]) + else: + for river in userRiver: + river = river.strip() + msg = get_flood_noaa(location[0], location[1], river) + return msg + def handle_wxc(message_from_id, deviceID, cmd): location = get_node_location(message_from_id, deviceID) if use_meteo_wxApi and not "wxc" in cmd and not use_metric: diff --git a/modules/locationdata.py b/modules/locationdata.py index ee8fabf..81fd6c2 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", "ea", "ealert") +trap_list_location = ("whereami", "tide", "moon", "wx", "wxc", "wxa", "wxalert", "rlist", "ea", "ealert", "riverflow") def where_am_i(lat=0, lon=0, short=False, zip=False): whereIam = "" @@ -604,7 +604,7 @@ def get_flood_noaa(lat=0, lon=0, uid=0): return ERROR_FETCHING_DATA # format the flood data - flood_data = f"Flood Gauge Data for {name}:\n" + flood_data = f"Flood Data {name}:\n" flood_data += f"Observed: {status_observed_primary}{status_observed_primary_unit}({status_observed_secondary}{status_observed_secondary_unit}) risk: {status_observed_floodCategory}" flood_data += f"\nForecast: {status_forecast_primary}{status_forecast_primary_unit}({status_forecast_secondary}{status_forecast_secondary_unit}) risk: {status_forecast_floodCategory}" diff --git a/modules/settings.py b/modules/settings.py index b234346..e34185b 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -168,6 +168,7 @@ try: ignoreFEMAtest = config['location'].getboolean('ignoreFEMAtest', True) # default True n2yoAPIKey = config['location'].get('n2yoAPIKey', '') # default empty satListConfig = config['location'].get('satList', '25544').split(',') # default 25544 ISS + riverListDefault = config['location'].get('riverList', '').split(',') # default 12061500 Skagit River # brodcast channel for weather alerts wxAlertBroadcastChannel = config['location'].get('wxAlertBroadcastCh') if wxAlertBroadcastChannel: diff --git a/modules/wx_meteo.py b/modules/wx_meteo.py index 5bd3ace..401e6b7 100644 --- a/modules/wx_meteo.py +++ b/modules/wx_meteo.py @@ -198,10 +198,6 @@ def get_flood_openmeteo(lat=0, lon=0): # set forcast days 1 or 3 forecastDays = 3 - if lat == 0 and lon == 0: - # Default to the location in config.ini - lat = latitudeValue - lon = longitudeValue # Flood data url = "https://flood-api.open-meteo.com/v1/flood" params = {