From df9f3806a344374ec69e1790573fc610791e93aa Mon Sep 17 00:00:00 2001 From: pdxlocations Date: Sun, 19 Oct 2025 16:00:45 -0700 Subject: [PATCH] Enhance TCP interface initialization to support host:port format --- modules/system.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/system.py b/modules/system.py index 4886015..1744656 100644 --- a/modules/system.py +++ b/modules/system.py @@ -331,7 +331,20 @@ for i in range(1, 10): if interface_type == 'serial': globals()[f'interface{i}'] = meshtastic.serial_interface.SerialInterface(globals().get(f'port{i}')) elif interface_type == 'tcp': - globals()[f'interface{i}'] = meshtastic.tcp_interface.TCPInterface(globals().get(f'hostname{i}')) + host = globals().get(f'hostname{i}', '127.0.0.1') + port = 4403 + + # Allow host:port format + if isinstance(host, str) and ':' in host: + maybe_host, maybe_port = host.rsplit(':', 1) + if maybe_port.isdigit(): + host = maybe_host + try: + port = int(maybe_port) + except ValueError: + port = 4403 + + globals()[f'interface{i}'] = meshtastic.tcp_interface.TCPInterface(hostname=host, portNumber=port) elif interface_type == 'ble': globals()[f'interface{i}'] = meshtastic.ble_interface.BLEInterface(globals().get(f'mac{i}')) else: