mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-07-04 17:01:03 +02:00
locationEnhance
This commit is contained in:
@@ -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,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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user