From 2030f892feb0bb132215ad68248b95c91fb7b5f0 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 19 Jun 2024 15:20:02 -0700 Subject: [PATCH] Update mesh-bot.py --- mesh-bot.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mesh-bot.py b/mesh-bot.py index 939cf42..04dad08 100644 --- a/mesh-bot.py +++ b/mesh-bot.py @@ -11,13 +11,14 @@ import meshtastic.ble_interface from datetime import datetime from solarconditions import * # from the spudgunman/meshing-around repo +from locationdata import * # from the spudgunman/meshing-around repo # Uncomment the interface you want to use depending on your device connection 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","sun","solar","hfcond","lheard") #A list of strings to trap and respond to +trap_list = ("ping","ack","testing","pong","motd","help","sun","solar","hfcond","lheard","whereami") #A list of strings to trap and respond to welcome_message = "MeshBot, here for you like a friend who is not. Try sending: ping @foo or, help" help_message = "Commands are: ping, ack, motd, sun, solar, hfcond, 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) @@ -77,6 +78,11 @@ def auto_response(message,snr,rssi,hop,message_from_id): bot_response = drap_xray_conditions() + "\n" + solar_conditions() elif "lheard" in message.lower(): bot_response = "Last 5 nodes heard: " + str(get_node_list()) + elif "whereami" in message.lower(): + location = get_node_location(message_from_id) + print (f"Using Reported Location: {location}") + where = where_am_i(str(location[0]),str(location[1])) + bot_response = where else: bot_response = "I'm sorry, I'm afraid I can't do that."