From 899eeebd09288ca5a9a97e3a43db419ad42cedb9 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Sun, 16 Nov 2025 22:25:18 +0000 Subject: [PATCH 1/2] docs: update TCP port from 12345 to 5000 Updated all documentation references to reflect the correct TCP port 5000 for MeshCore device connections, as verified with Heltec V3. - Updated README.md (8 instances including Docker section) - Updated config.example.yaml - Updated config.example.json Fixes #13 Co-authored-by: JingleManSweep --- README.md | 16 ++++++++-------- config.example.json | 2 +- config.example.yaml | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 71d4fb3..d4e236f 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ The bridge supports multiple configuration methods with the following precedence #### MeshCore Settings - `meshcore_connection`: Connection type (serial, ble, tcp) - `meshcore_address`: Device address (required) -- `meshcore_port`: Device port for TCP connections (default: 12345) +- `meshcore_port`: Device port for TCP connections (default: 5000) - `meshcore_baudrate`: Baudrate for serial connections (default: 115200) - `meshcore_timeout`: Operation timeout in seconds (default: 5) - `meshcore_auto_fetch_restart_delay`: Delay in seconds before restarting auto-fetch after NO_MORE_MSGS (default: 5, range: 1-60) @@ -93,7 +93,7 @@ The bridge supports multiple configuration methods with the following precedence "meshcore": { "connection_type": "tcp", "address": "192.168.1.100", - "port": 12345, + "port": 5000, "baudrate": 115200, "timeout": 10, "auto_fetch_restart_delay": 10, @@ -126,7 +126,7 @@ mqtt: meshcore: connection_type: tcp address: "192.168.1.100" - port: 12345 + port: 5000 baudrate: 115200 timeout: 10 auto_fetch_restart_delay: 10 @@ -151,7 +151,7 @@ export MQTT_USERNAME=myuser export MQTT_PASSWORD=mypass export MESHCORE_CONNECTION=tcp export MESHCORE_ADDRESS=192.168.1.100 -export MESHCORE_PORT=12345 +export MESHCORE_PORT=5000 export MESHCORE_BAUDRATE=115200 export MESHCORE_AUTO_FETCH_RESTART_DELAY=10 export MESHCORE_MESSAGE_INITIAL_DELAY=15.0 @@ -177,7 +177,7 @@ python -m meshcore_mqtt.main \ --mqtt-password mypass \ --meshcore-connection tcp \ --meshcore-address 192.168.1.100 \ - --meshcore-port 12345 \ + --meshcore-port 5000 \ --meshcore-auto-fetch-restart-delay 10 \ --meshcore-events "CONNECTED,DISCONNECTED,BATTERY" ``` @@ -195,7 +195,7 @@ python -m meshcore_mqtt.main \ --mqtt-broker localhost \ --meshcore-connection tcp \ --meshcore-address 192.168.1.100 \ - --meshcore-port 12345 + --meshcore-port 5000 ``` #### Serial Connection @@ -552,7 +552,7 @@ MQTT_TLS_INSECURE=false MESHCORE_CONNECTION=serial MESHCORE_ADDRESS=/dev/ttyUSB0 # Serial port, IP address, or BLE MAC address MESHCORE_BAUDRATE=115200 # For serial connections -MESHCORE_PORT=4403 # Only for TCP connections +MESHCORE_PORT=5000 # Only for TCP connections MESHCORE_TIMEOUT=30 MESHCORE_AUTO_FETCH_RESTART_DELAY=10 # Restart delay after NO_MORE_MSGS (1-60 seconds) MESHCORE_MESSAGE_INITIAL_DELAY=15.0 # Initial delay before first message (0.0-60.0 seconds) @@ -576,7 +576,7 @@ MESHCORE_BAUDRATE=115200 ```bash MESHCORE_CONNECTION=tcp MESHCORE_ADDRESS=192.168.1.100 -MESHCORE_PORT=4403 +MESHCORE_PORT=5000 ``` **BLE Connection:** diff --git a/config.example.json b/config.example.json index 7964f0e..273347a 100644 --- a/config.example.json +++ b/config.example.json @@ -11,7 +11,7 @@ "meshcore": { "connection_type": "tcp", "address": "192.168.1.100", - "port": 12345, + "port": 5000, "baudrate": 115200, "timeout": 5, "auto_fetch_restart_delay": 5, diff --git a/config.example.yaml b/config.example.yaml index b1e4321..aa5ce4f 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -10,7 +10,7 @@ mqtt: meshcore: connection_type: tcp address: "192.168.1.100" - port: 12345 + port: 5000 baudrate: 115200 timeout: 5 auto_fetch_restart_delay: 5 From e94f065451fbfe18d022def5170e2998a810e8e6 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Sun, 16 Nov 2025 22:32:55 +0000 Subject: [PATCH 2/2] fix: update default TCP port from 12345 to 5000 in code and tests Updates the default TCP port throughout the codebase to match the documentation changes made in the previous commit. Changes: - config.py: Update TCP port validator default (line 136) - config.py: Update environment variable fallback default (line 255) - test_config.py: Update test assertions (lines 117, 145) - test_bridge.py: Update test assertion and fixture (lines 23, 63) - test_command_forwarding.py: Update test fixture (line 20) - test_rate_limiting.py: Update test fixtures (lines 22, 37) Co-authored-by: JingleManSweep --- meshcore_mqtt/config.py | 4 ++-- tests/test_bridge.py | 4 ++-- tests/test_command_forwarding.py | 2 +- tests/test_config.py | 6 +++--- tests/test_rate_limiting.py | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/meshcore_mqtt/config.py b/meshcore_mqtt/config.py index 41bd2a7..9c9ed3a 100644 --- a/meshcore_mqtt/config.py +++ b/meshcore_mqtt/config.py @@ -133,7 +133,7 @@ class MeshCoreConfig(BaseModel): # Set default port for TCP if None provided if connection_type == ConnectionType.TCP and v is None: - v = 12345 + v = 5000 if v is not None and not 1 <= v <= 65535: raise ValueError("Port must be between 1 and 65535") @@ -252,7 +252,7 @@ class Config(BaseModel): connection_type=ConnectionType(os.getenv("MESHCORE_CONNECTION", "tcp")), address=os.getenv("MESHCORE_ADDRESS", ""), port=( - int(os.getenv("MESHCORE_PORT", "12345")) + int(os.getenv("MESHCORE_PORT", "5000")) if os.getenv("MESHCORE_PORT") else None ), diff --git a/tests/test_bridge.py b/tests/test_bridge.py index 9a31aa4..89be72b 100644 --- a/tests/test_bridge.py +++ b/tests/test_bridge.py @@ -20,7 +20,7 @@ def test_config() -> Config: meshcore=MeshCoreConfig( connection_type=ConnectionType.TCP, address="127.0.0.1", - port=12345, + port=5000, ), ) @@ -60,7 +60,7 @@ class TestBridgeCoordinator: bridge = BridgeCoordinator(test_config) assert bridge.config.meshcore.connection_type == ConnectionType.TCP assert bridge.config.meshcore.address == "127.0.0.1" - assert bridge.config.meshcore.port == 12345 + assert bridge.config.meshcore.port == 5000 def test_serial_connection_config(self) -> None: """Test serial connection configuration.""" diff --git a/tests/test_command_forwarding.py b/tests/test_command_forwarding.py index 32bf0cf..5f2ba58 100644 --- a/tests/test_command_forwarding.py +++ b/tests/test_command_forwarding.py @@ -17,7 +17,7 @@ def test_config() -> Config: meshcore=MeshCoreConfig( connection_type=ConnectionType.TCP, address="127.0.0.1", - port=12345, + port=5000, ), ) diff --git a/tests/test_config.py b/tests/test_config.py index de23e47..66e9e46 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -110,11 +110,11 @@ class TestMeshCoreConfig: def test_valid_tcp_config(self) -> None: """Test valid TCP configuration.""" config = MeshCoreConfig( - connection_type=ConnectionType.TCP, address="192.168.1.100", port=12345 + connection_type=ConnectionType.TCP, address="192.168.1.100", port=5000 ) assert config.connection_type == ConnectionType.TCP assert config.address == "192.168.1.100" - assert config.port == 12345 + assert config.port == 5000 assert config.timeout == 5 def test_valid_serial_config(self) -> None: @@ -142,7 +142,7 @@ class TestMeshCoreConfig: config = MeshCoreConfig( connection_type=ConnectionType.TCP, address="192.168.1.100", port=None ) - assert config.port == 12345 + assert config.port == 5000 def test_custom_baudrate(self) -> None: """Test custom baudrate for serial connections.""" diff --git a/tests/test_rate_limiting.py b/tests/test_rate_limiting.py index 8950494..a0620da 100644 --- a/tests/test_rate_limiting.py +++ b/tests/test_rate_limiting.py @@ -19,7 +19,7 @@ def test_config() -> Config: meshcore=MeshCoreConfig( connection_type=ConnectionType.TCP, address="127.0.0.1", - port=12345, + port=5000, message_initial_delay=0.1, # 100ms for faster tests message_send_delay=0.2, # 200ms for faster tests ), @@ -34,7 +34,7 @@ def test_config_zero_delays() -> Config: meshcore=MeshCoreConfig( connection_type=ConnectionType.TCP, address="127.0.0.1", - port=12345, + port=5000, message_initial_delay=0.0, message_send_delay=0.0, ),