adafruit / Adafruit_CircuitPython_AdafruitIO

Adafruit IO for CircuitPython
http://io.adafruit.com
MIT License
49 stars 33 forks source link

MQTT port missing #89

Closed Vsaggiomo closed 2 years ago

Vsaggiomo commented 2 years ago

In the example files, the MQTT port is missing and the microcontroller will not manage to connect to Adafruit IO giving an error in _get_connect_socket. Adding a line with the port will solve this problem:

Initialize a new MQTT Client object

mqtt_client = MQTT.MQTT( broker="io.adafruit.com", port=1883, #IMPORTANT this is missing in the example file! username=secrets["aio_username"], password=secrets["aio_key"],

FoamyGuy commented 2 years ago

Thanks for reporting. Would you be willing to make a PR with this change?

brentru commented 2 years ago

Could you post the error from the REPL?

Vsaggiomo commented 2 years ago

Without the "port=1883" this is the error:

Connecting to WiFi... Connected! Connecting to Adafruit IO... Traceback (most recent call last): File "", line 117, in File "adafruit_io/adafruit_io.py", line 111, in connect AdafruitIO_MQTTError: MQTT Error: Unable to connect to Adafruit IO.

the line 117 in the code is: io.connect()

brentru commented 2 years ago

@Vsaggiomo What hardware are you using to connect to Adafruit IO? Which example?

Vsaggiomo commented 2 years ago

Arduino Nano Connect 2040. And all the MQTT examples. I think that some previous versions of the lib had the port in secrets.py. Now the port disapeared both in secrets.py and in the code.

FoamyGuy commented 2 years ago

@brentru just checking in, is there anything further needed on this one?

brentru commented 2 years ago

@FoamyGuy Addressed in https://github.com/adafruit/Adafruit_CircuitPython_AdafruitIO/pull/90