From 3e8553b84805d930c5f2e0003094b12f5cb90557 Mon Sep 17 00:00:00 2001 From: Camerin Figueroa Date: Fri, 7 Nov 2025 23:05:17 -0500 Subject: [PATCH 1/2] Handle radio connection loss I added a flag and function to handle when the connection to the node is lost. This will now close the script and docker should detect this and restart the container --- server.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index 177f82f..c7b4c2d 100644 --- a/server.py +++ b/server.py @@ -37,6 +37,8 @@ js8call_formatter = logging.Formatter('%(asctime)s - JS8Call - %(levelname)s - % js8call_handler.setFormatter(js8call_formatter) js8call_logger.addHandler(js8call_handler) +continue_running = True + def display_banner(): banner = """ ████████╗ ██████╗██████╗ ██████╗ ██████╗ ███████╗ @@ -70,7 +72,13 @@ def main(): def receive_packet(packet, interface): on_receive(packet, interface) + def on_connection_loss(interface): + logging.error("Connection to Meshtastic device lost.") + global continue_running + continue_running = False + pub.subscribe(receive_packet, system_config['mqtt_topic']) + pub.subscribe(on_connection_loss, 'meshtastic.connection.lost') # Initialize and start JS8Call Client if configured js8call_client = JS8CallClient(interface) @@ -80,7 +88,7 @@ def main(): js8call_client.connect() try: - while True: + while continue_running: time.sleep(1) except KeyboardInterrupt: From d2914c0913a0b1a471b7f8897282e9e57ce9d77f Mon Sep 17 00:00:00 2001 From: Camerin Date: Sat, 22 Nov 2025 21:08:27 -0500 Subject: [PATCH 2/2] alpine tagged python docker image causes a disconnect bug that can't be caught by the 'meshtastic.connection.lost' event --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 2f9f33e..600895a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -11,7 +11,7 @@ RUN git clone https://github.com/TheCommsChannel/TC2-BBS-mesh.git #### -FROM --platform=$BUILDPLATFORM python:alpine +FROM --platform=$BUILDPLATFORM python:3.13.9-alpine # Switch to non-root user RUN adduser --disabled-password mesh