Skip to content

Commit 55eb407

Browse files
committed
fix: use port 8883 as default for MQTT when TLS is enabled
When no explicit port is specified in the MQTT broker address, the proxy always defaults to port 1883. This causes a "Connection reset by peer" error when TLS is enabled, since TLS brokers typically listen on port 8883. Default to 8883 when tls_enabled is true, 1883 otherwise.
1 parent 8844217 commit 55eb407

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

custom_components/meshtastic/aiomeshtastic/interface.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,8 @@ async def _init_mqtt_client(self) -> None:
418418

419419
# Parse broker address
420420
hostname = broker.split(":", 1)[0]
421-
port = int(broker.split(":", 1)[1]) if ":" in broker else 1883
421+
default_port = 8883 if use_tls else 1883
422+
port = int(broker.split(":", 1)[1]) if ":" in broker else default_port
422423

423424
# Get node ID for client identifier
424425
node_id = self._connected_node_info.my_node_num

0 commit comments

Comments
 (0)