From 5141b2b7e679509cb9e68f17fd95d8b492654109 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 26 Jun 2024 11:12:56 -0700 Subject: [PATCH 1/5] Rename Of File sorry everyone --- mesh-bot.py => mesh_bot.py | 0 mesh-bot.service => mesh_bot.service | 0 pong-bot.py => pong_bot.py | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename mesh-bot.py => mesh_bot.py (100%) rename mesh-bot.service => mesh_bot.service (100%) rename pong-bot.py => pong_bot.py (100%) diff --git a/mesh-bot.py b/mesh_bot.py similarity index 100% rename from mesh-bot.py rename to mesh_bot.py diff --git a/mesh-bot.service b/mesh_bot.service similarity index 100% rename from mesh-bot.service rename to mesh_bot.service diff --git a/pong-bot.py b/pong_bot.py similarity index 100% rename from pong-bot.py rename to pong_bot.py From b7e695a302f30772b926763f6bcdb2960027f4b3 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 26 Jun 2024 11:23:03 -0700 Subject: [PATCH 2/5] Update pong_bot.py --- pong_bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pong_bot.py b/pong_bot.py index cdacdc3..20bb568 100755 --- a/pong_bot.py +++ b/pong_bot.py @@ -15,7 +15,7 @@ interface = meshtastic.serial_interface.SerialInterface() #serial interface #interface=meshtastic.tcp_interface.TCPInterface(hostname="192.168.0.1") # IP of your device #interface=meshtastic.ble_interface.BLEInterface("AA:BB:CC:DD:EE:FF") # BLE interface -trap_list = ("ping","ack","testing","pong","motd","help","lheard","sitrep") #A list of strings to trap and respond to +trap_list = ("ping", "ack", "testing", "pong", "motd", "help", "lheard", "sitrep") #A list of strings to trap and respond to welcome_message = "PongBot, here for you like a friend who is not. Try sending: ping @foo or, help" help_message = "Commands are: ping, ack, motd, Lheard. Use 'motd $foo' to set MOTD." RESPOND_BY_DM_ONLY = True # Set to True to respond messages via DM only (keeps the channel clean) From 64abadbf10a2a04076deb72801e5fcc8080fa870 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 26 Jun 2024 11:23:17 -0700 Subject: [PATCH 3/5] Update locationdata.py --- locationdata.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/locationdata.py b/locationdata.py index 7919c71..444ebf6 100644 --- a/locationdata.py +++ b/locationdata.py @@ -66,11 +66,18 @@ def get_tide(lat=0, lon=0): else: return "error fetching tide data" -def get_weather(lat=0, lon=0): +def get_weather(lat=0, lon=0, unit=0): weather = "" if float(lat) == 0 and float(lon) == 0: return "no location data: does your device have GPS?" - weather_url = "https://forecast.weather.gov/MapClick.php?FcstType=text&lat=" + str(lat) + "&lon=" + str(lon) + + if unit == 0: + # default to imperial units + weather_url = "https://forecast.weather.gov/MapClick.php?FcstType=text&lat=" + str(lat) + "&lon=" + str(lon) + else: + # metric units + weather_url = "https://forecast.weather.gov/MapClick.php?FcstType=text&unit=1&lat=" + str(lat) + "&lon=" + str(lon) + weather_data = requests.get(weather_url, timeout=URL_TIMEOUT) if(weather_data.ok): soup = bs.BeautifulSoup(weather_data.text, 'html.parser') From d1db7981dd52c43c71a1cf61eb4425ad58c35b6e Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 26 Jun 2024 11:23:21 -0700 Subject: [PATCH 4/5] Update mesh_bot.py --- mesh_bot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 2de83c9..17c1187 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -19,8 +19,8 @@ interface = meshtastic.serial_interface.SerialInterface() #serial interface #interface=meshtastic.ble_interface.BLEInterface("AA:BB:CC:DD:EE:FF") # BLE interface #A list of strings to trap and respond to -trap_list = ("ping","ack","testing","pong","motd","help","sun","solar","hfcond","lheard","sitrep", \ - "whereami","tide","moon","wx","joke","bbslist","bbspost","bbsread","bbsdelete","bbshelp") +trap_list = ("ping", "ack", "testing", "pong", "motd", "help", "sun", "solar", "hfcond", "lheard", "sitrep", \ + "whereami", "tide", "moon", "wx", "wxc", "joke", "bbslist", "bbspost", "bbsread", "bbsdelete", "bbshelp") welcome_message = "MeshBot, here for you like a friend who is not. Try sending: ping @foo or, help" help_message = "Commands are: ack, hfcond, joke, Lheard, moon, motd, ping, solar, sun, tide, whereami, wx, bbshelp" @@ -92,6 +92,10 @@ def auto_response(message, snr, rssi, hop, message_from_id): location = get_node_location(message_from_id) moon = get_moon(str(location[0]),str(location[1])) bot_response = moon + elif "wxc" in message.lower(): + location = get_node_location(message_from_id) + 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) weather = get_weather(str(location[0]),str(location[1])) From bd3804cba9b2fe8e04c252e35b533094ed1c2295 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 26 Jun 2024 11:23:23 -0700 Subject: [PATCH 5/5] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 05149c3..8940be5 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ other features - Various solar details for radio propigation - `sun` and `moon` return info on rise and set local time - - uses the locaton of the node if known - `solar` gives an idea of the x-ray flux - `hfcond` returns a table of HF solar conditions - Bulliten Board (BBS) functions