From 41f37997de14841822991cc38cc66c1ec12af213 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Thu, 1 Aug 2024 01:14:47 -0700 Subject: [PATCH] cleanup a few things --- mesh_bot.py | 7 ++++++- modules/settings.py | 1 + modules/system.py | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/mesh_bot.py b/mesh_bot.py index 530e11a..c178e3a 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -65,8 +65,13 @@ def auto_response(message, snr, rssi, hop, message_from_id, channel_number, devi bot_response = drap_xray_conditions() + "\n" + solar_conditions() elif "lheard" in message.lower() or "sitrep" in message.lower(): bot_response = "Last heard:\n" + str(get_node_list(1)) + chutil1 = interface1.nodes.get(decimal_to_hex(myNodeNum1), {}).get("deviceMetrics", {}).get("channelUtilization", 0) if interface2_enabled: - bot_response += "\nPort2:\n" + str(get_node_list(2)) + bot_response += "Port2:\n" + str(get_node_list(2)) + chutil2 = interface2.nodes.get(decimal_to_hex(myNodeNum2), {}).get("deviceMetrics", {}).get("channelUtilization", 0) + bot_response += "Ch Use: " + str(chutil1) + "%" + if interface2_enabled: + bot_response += " P2:" + str(chutil2) + "%" elif "whereami" in message.lower(): location = get_node_location(message_from_id, deviceID) where = where_am_i(str(location[0]),str(location[1])) diff --git a/modules/settings.py b/modules/settings.py index 86ce066..b415b16 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -9,6 +9,7 @@ NO_ALERTS = "No weather alerts found." # setup the global variables MESSAGE_CHUNK_SIZE = 160 # message chunk size for sending at high success rate +SITREP_NODE_COUNT = 3 # number of nodes to report in the sitrep msg_history = [] # message history for the store and forward feature bbs_ban_list = [] # list of banned users bbs_admin_list = [] # list of admin users diff --git a/modules/system.py b/modules/system.py index d8d51f1..35c7130 100644 --- a/modules/system.py +++ b/modules/system.py @@ -197,9 +197,9 @@ def get_node_list(nodeInt=1): node_list2.sort(key=lambda x: x[1], reverse=True) # make a nice list for the user - for x in node_list1[:5]: + for x in node_list1[:SITREP_NODE_COUNT]: short_node_list.append(f"{x[0]} SNR:{x[2]}") - for x in node_list2[:5]: + for x in node_list2[:SITREP_NODE_COUNT]: short_node_list.append(f"{x[0]} SNR:{x[2]}") for x in short_node_list: