micropython-mqtt icon indicating copy to clipboard operation
micropython-mqtt copied to clipboard

WiFi connection times out after ~2 seconds on Nano RP2040 Connect

Open sebromero opened this issue 2 months ago • 3 comments

When connecting to WiFi using config parameters, the connection times out after roughly 2 seconds with the following message:

>OKTraceback (most recent call last):
  File "<stdin>", line 36, in <module>
  File "asyncio/core.py", line 1, in run
  File "asyncio/core.py", line 1, in run_until_complete
  File "asyncio/core.py", line 1, in run_until_complete
  File "<stdin>", line 21, in main
  File "/lib/mqtt_as/__init__.py", line 778, in connect
  File "/lib/mqtt_as/__init__.py", line 766, in wifi_connect
OSError: Wi-Fi connect timed out

I'm on Nano RP2040 and MicroPython 1.26.1 and Nina FW 2.0.0.

When I connect to the WiFi manually before connecting the MQTT client, I get:

Traceback (most recent call last):
  File "<stdin>", line 49, in <module>
  File "asyncio/core.py", line 1, in run
  File "asyncio/core.py", line 1, in run_until_complete
  File "asyncio/core.py", line 1, in run_until_complete
  File "<stdin>", line 21, in main
  File "/lib/mqtt_as/__init__.py", line 800, in connect
  File "/lib/mqtt_as/__init__.py", line 313, in _connect
  File "ssl.py", line 1, in wrap_socket
  File "ssl.py", line 1, in wrap_socket
OSError: [Errno 119] EINPROGRESS

sebromero avatar Oct 26 '25 23:10 sebromero

Maybe it's got something to do with that: The else statement here seems to be wrongly indented. It looks like that code should be executed after the for loop completes, so the else statement should maybe be removed?

sebromero avatar Oct 27 '25 11:10 sebromero

Maybe it's got something to do with that: The else statement here seems to be wrongly indented. It looks like that code should be executed after the for loop completes, so the else statement should maybe be removed?

The code was designed for everyone to enjoy it. You can always change it to your taste😉

ebolisa avatar Oct 27 '25 16:10 ebolisa

See my comment to https://github.com/peterhinch/micropython-mqtt/issues/174.

peterhinch avatar Oct 28 '25 08:10 peterhinch