diff --git a/README.md b/README.md index cf6bc9b..a19dcc6 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ Welcome to the Mesh Bot project! This feature-rich bot is designed to enhance yo ### Proximity Alerts - **Location-Based Alerts**: Get notified when members arrive back at a configured lat/long, perfect for remote locations like campsites. +- **High Flying Alerts**: Get notified when nodes with high altitude are seen on mesh ### CheckList / Check In Out - **Asset Tracking**: Maintain a list of node/asset checkin and checkout. Usefull for accountability of people, assets. Radio-Net, FEMA, Trailhead. @@ -181,6 +182,8 @@ SentryRadius = 100 # radius in meters to detect someone close to the bot SentryChannel = 9 # holdoff time multiplied by seconds(20) of the watchdog SentryHoldoff = 2 # channel to send a message to when the watchdog is triggered sentryIgnoreList = # list of ignored nodes numbers ex: 2813308004,4258675309 +highFlyingAlert = True # HighFlying Node alert +highFlyingAlertAltitude = 2000 # Altitude in meters to trigger the alert ``` ### E-Mail / SMS Settings @@ -479,6 +482,7 @@ I used ideas and snippets from other responder bots and want to call them out! - **Josh**: For more bashing on installer! - **dj505**: trying it on windows! - **mikecarper**: ideas, and testing. hamtest +- **c.merphy360**: high altitude alerts - **Cisien, bitflip, **Woof**, **propstg**, **trs2982**, **Josh** and Hailo1999**: For testing and feature ideas on Discord and GitHub. - **Meshtastic Discord Community**: For tossing out ideas and testing code. diff --git a/config.template b/config.template index 1da8971..92aa9cf 100644 --- a/config.template +++ b/config.template @@ -103,6 +103,12 @@ SentryChannel = 2 SentryHoldoff = 9 # list of ignored nodes numbers ex: 2813308004,4258675309 sentryIgnoreList = +# HighFlying Node alert +highFlyingAlert = True +# Altitude in meters to trigger the alert +highFlyingAlertAltitude = 2000 +# Channel to send Alert when the high flying node is detected +highFlyingAlertChannel = 2 [bbs] enabled = True @@ -291,7 +297,7 @@ splitDelay = 0.0 MESSAGE_CHUNK_SIZE = 160 # Request Acknowledgement of message OTA wantAck = False -# Max limit buffer for radio testing. 233 is hard limit 2.5+ firmware +# Max limit buffer for radio testing maxBuffer = 200 #Enable Extra logging of Hop count data enableHopLogs = False diff --git a/mesh_bot.py b/mesh_bot.py index f424b61..0d142d0 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -1406,6 +1406,8 @@ async def start_rx(): logger.debug(f"System: MOTD Enabled using {MOTD}") if sentry_enabled: logger.debug(f"System: Sentry Mode Enabled {sentry_radius}m radius reporting to channel:{secure_channel}") + if highfly_enabled: + logger.debug(f"System: HighFly Enabled using {highfly_altitude}m limit reporting to channel:{highfly_channel}") if store_forward_enabled: logger.debug(f"System: Store and Forward Enabled using limit: {storeFlimit}") if useDMForResponse: diff --git a/modules/settings.py b/modules/settings.py index 3583da4..ce269d6 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -235,6 +235,9 @@ try: sentryIgnoreList = config['sentry'].get('sentryIgnoreList', '').split(',') sentry_radius = config['sentry'].getint('SentryRadius', 100) # default 100 meters email_sentry_alerts = config['sentry'].getboolean('emailSentryAlerts', False) # default False + highfly_enabled = config['sentry'].getboolean('highFlyingAlert', True) # default True + highfly_altitude = config['sentry'].getint('highFlyingAlertAltitude', 2000) # default 2000 meters + highfly_channel = config['sentry'].getint('highFlyingAlertChannel', 2) # default 2 # location location_enabled = config['location'].getboolean('enabled', True) diff --git a/modules/system.py b/modules/system.py index 79aba54..324bbc1 100644 --- a/modules/system.py +++ b/modules/system.py @@ -978,6 +978,12 @@ def consumeMetadata(packet, rxNode=0): for key in keys: positionMetadata[nodeID][key] = position_data.get(key, 0) + + # if altitude is over 2000 send a log and message for high-flying nodes + if position_data.get('altitude', 0) > highfly_altitude and highfly_enabled: + logger.info(f"System: High Altitude {position_data['altitude']}m on Device: {rxNode} NodeID: {nodeID}") + send_message(f"High Altitude {position_data['altitude']}m on Device:{rxNode} Node:{get_name_from_number(nodeID,'short',rxNode)}", highfly_channel, 0, rxNode) + time.sleep(responseDelay) # Keep the positionMetadata dictionary at a maximum size of 20 if len(positionMetadata) > 20: @@ -1151,7 +1157,7 @@ async def retry_interface(nodeID): if interface_type == 'serial': globals()[f'interface{nodeID}'] = meshtastic.serial_interface.SerialInterface(globals().get(f'port{nodeID}')) elif interface_type == 'tcp': - globals()[f'interface{nodeID}'] = meshtastic.tcp_interface.TCPInterface(globals().get(f'hostname{nodeID}')) + globals()[f'interface{nodeID}'] = meshtastic.tcp_interface.TCPInterface(globals().get(f'host{nodeID}')) elif interface_type == 'ble': globals()[f'interface{nodeID}'] = meshtastic.ble_interface.BLEInterface(globals().get(f'mac{nodeID}')) logger.debug(f"System: Interface{nodeID} Opened!")