diff --git a/modules/locationdata.py b/modules/locationdata.py index 18c0bc7..ba4389f 100644 --- a/modules/locationdata.py +++ b/modules/locationdata.py @@ -325,11 +325,15 @@ def abbreviate_weather(row): return line -def getWeatherAlerts(lat=0, lon=0): +def getWeatherAlerts(lat=0, lon=0, useDefaultLatLon=False): # get weather alerts from NOAA limited to ALERT_COUNT with the total number of alerts found alerts = "" - if float(lat) == 0 and float(lon) == 0: + if float(lat) == 0 and float(lon) == 0 and not useDefaultLatLon: return NO_DATA_NOGPS + else: + if useDefaultLatLon: + lat = latitudeValue + lon = longitudeValue alert_url = "https://api.weather.gov/alerts/active.atom?point=" + str(lat) + "," + str(lon) #alert_url = "https://api.weather.gov/alerts/active.atom?area=WA" @@ -373,7 +377,7 @@ wxAlertCache = "" def alertBrodcast(): # get the latest weather alerts and broadcast them if there are any global wxAlertCache - currentAlert = getWeatherAlerts() + currentAlert = getWeatherAlerts(latitudeValue, longitudeValue) if currentAlert[0] == ERROR_FETCHING_DATA or currentAlert == NO_DATA_NOGPS or currentAlert == NO_ALERTS: wxAlertCache = ""