locationEnhance

This commit is contained in:
SpudGunMan
2024-12-18 15:09:38 -08:00
parent 4aaac5ba49
commit bd956dfebc
4 changed files with 16 additions and 1 deletions
+2
View File
@@ -124,8 +124,10 @@ repeaterLookup = rbook
NOAAforecastDuration = 4
# number of weather alerts to display
NOAAalertCount = 2
# use Open-Meteo API for weather data not NOAA useful for non US locations
UseMeteoWxAPI = False
includeEUalerts = False
# NOAA Hydrology
# unique identifiers, LID or USGS ID
+9 -1
View File
@@ -9,13 +9,21 @@ import bs4 as bs # pip install beautifulsoup4
import xml.dom.minidom
from modules.log import *
trap_list_location_eu = ("ukalert", "ukwx", "ukflood")
def get_govUK_alerts():
# get UK weather alerts
url = 'https://www.gov.uk/alerts'
response = requests.get(url)
soup = bs.BeautifulSoup(response.text, 'html.parser')
return "not implemented yet"
# the alerts are in <h2 class="govuk-heading-m" id="alert-status">
alert = soup.find('h2', class_='govuk-heading-m', id='alert-status')
if alert:
return alert.text
else:
return "No alerts"
def get_wxUKgov():
# get UK weather warnings
url = 'https://www.metoffice.gov.uk/weather/guides/rss'
+1
View File
@@ -155,6 +155,7 @@ try:
latitudeValue = config['location'].getfloat('lat', 48.50)
longitudeValue = config['location'].getfloat('lon', -123.0)
use_meteo_wxApi = config['location'].getboolean('UseMeteoWxAPI', False) # default False use NOAA
includeEUalerts = config['location'].getboolean('includeEUalerts', False) # default False
use_metric = config['location'].getboolean('useMetric', False) # default Imperial units
forecastDuration = config['location'].getint('NOAAforecastDuration', 4) # NOAA forcast days
numWxAlerts = config['location'].getint('NOAAalertCount', 2) # default 2 alerts
+4
View File
@@ -74,6 +74,10 @@ 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"
if includeEUalerts:
from modules.locationdata_eu import * # from the spudgunman/meshing-around repo
trap_list = trap_list + trap_list_location_eu
#help_message = help_message + ", ukalert, ukwx, ukflood"
# Open-Meteo Configuration for worldwide weather
if use_meteo_wxApi: