This commit is contained in:
SpudGunMan
2024-08-07 21:24:35 -07:00
parent 99a05c66ef
commit 0514d51aea
3 changed files with 13 additions and 9 deletions
+2
View File
@@ -60,6 +60,8 @@ NOAAforecastDuration = 4
NOAAalertCount = 2
# use Open-Meteo API for weather data not NOAA usefull for non US locations
UseMeteoWxAPI = False
# Default to metric units rather than imperial
useMetric = False
# solar module
[solar]
+10 -9
View File
@@ -89,18 +89,19 @@ def auto_response(message, snr, rssi, hop, message_from_id, channel_number, devi
location = get_node_location(message_from_id, deviceID)
weatherAlert = getActiveWeatherAlertsDetail(str(location[0]),str(location[1]))
bot_response = weatherAlert
elif "wxc" in message.lower():
elif "wxc" in message.lower() or "wx" in message.lower():
location = get_node_location(message_from_id, deviceID)
if use_meteo_wxApi:
weather = get_wx_meteo(str(location[0]),str(location[1]),1)
else:
weather = get_weather(str(location[0]),str(location[1]),1)
bot_response = weather
elif "wx" in message.lower():
location = get_node_location(message_from_id, deviceID)
if use_meteo_wxApi:
if use_meteo_wxApi and not "wxc" in message.lower() and not use_metric:
logger.debug(f"System: Returning Open-Meteo API for weather imperial")
weather = get_wx_meteo(str(location[0]),str(location[1]))
elif use_meteo_wxApi:
logger.debug(f"System: Returning Open-Meteo API for weather metric")
weather = get_wx_meteo(str(location[0]),str(location[1]),1)
elif not use_meteo_wxApi and "wxc" in message.lower() or use_metric:
logger.debug(f"System: Returning NOAA API for weather metric")
weather = get_weather(str(location[0]),str(location[1]),1)
else:
logger.debug(f"System: Returning NOAA API for weather imperial")
weather = get_weather(str(location[0]),str(location[1]))
bot_response = weather
elif "joke" in message.lower():
+1
View File
@@ -65,6 +65,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
use_metric = config['location'].getboolean('useMetric', False) # default Imperial units
zuluTime = config['general'].getboolean('zuluTime', False)
welcome_message = config['general'].get(f'welcome_message', WELCOME_MSG)
welcome_message = (f"{welcome_message}").replace('\\n', '\n') # allow for newlines in the welcome message