Skip to content

Commit 9678a8e

Browse files
authored
Update adafruit_espatcontrol_socket.py
I got error when using adafruit_espatcontrol_socket.py and adafruit_minimqtt when I use port 1883 for MQTT, it is due to connection type is not defined for port 1883 Traceback (most recent call last): File "code.py", line 117, in <module> File "/lib/adafruit_minimqtt/adafruit_minimqtt.py", line 447, in connect File "/lib/adafruit_minimqtt/adafruit_minimqtt.py", line 270, in _get_connect_socket File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_socket.py", line 85, in connect File "/lib/adafruit_espatcontrol/adafruit_espatcontrol.py", line 202, in socket_connect RuntimeError: Connection type must be TCP, UDL or SSL I propose to add conntype TCP for port 1883
1 parent 2866b43 commit 9678a8e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

adafruit_espatcontrol/adafruit_espatcontrol_socket.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ def connect(self, address: Tuple[str, int], conntype: Optional[str] = None) -> N
7373
conntype = "TCP"
7474
elif port == 443:
7575
conntype = "SSL"
76+
#to cater for MQTT over TCP
77+
elif port == 1883
78+
conntype = "TCP"
7679

7780
if not _the_interface.socket_connect(
7881
conntype, host, port, keepalive=10, retries=3

0 commit comments

Comments
 (0)