From 72cd6c9209fd24fcdcd70d88f91712e193775965 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 31 Jul 2024 22:49:16 -0700 Subject: [PATCH] wxAlert for localization --- modules/locationdata.py | 4 ++-- modules/settings.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/locationdata.py b/modules/locationdata.py index 681e79d..575dabe 100644 --- a/modules/locationdata.py +++ b/modules/locationdata.py @@ -131,7 +131,7 @@ def get_weather(lat=0, lon=0, unit=0): # get any alerts and return the count alerts = getWeatherAlerts(lat, lon) - if alerts == ERROR_FETCHING_DATA or alerts == NO_DATA_NOGPS: + if alerts == ERROR_FETCHING_DATA or alerts == NO_DATA_NOGPS or alerts == NO_ALERTS: alert = "" alert_num = 0 else: @@ -213,7 +213,7 @@ def getWeatherAlerts(lat=0, lon=0): ) if alerts == "" or alerts == None: - return "No weather alerts found." + return NO_ALERTS # trim off last newline if alerts[-1] == "\n": diff --git a/modules/settings.py b/modules/settings.py index 428320a..86ce066 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -5,6 +5,7 @@ NO_DATA_NOGPS = "No location data: does your device have GPS?" ERROR_FETCHING_DATA = "error fetching data" WELCOME_MSG = 'MeshBot, here for you like a friend who is not. Try sending: ping @foo or, cmd' MOTD = 'Thanks for using MeshBOT! Have a good day!' +NO_ALERTS = "No weather alerts found." # setup the global variables MESSAGE_CHUNK_SIZE = 160 # message chunk size for sending at high success rate