Different behavior with different routers

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
nofurey
Posts: 1
Joined: Fri Jan 10, 2020 12:46 pm

Different behavior with different routers

Post by nofurey » Fri Jan 10, 2020 12:55 pm

I have a simple main.py that sends mqtt messages to AWS. I have been having problems related to the device functioning properly after the wifi connection was lost then reconnected. I have two routers at work that both result in the following error after the internet connection is re-established.

Code: Select all

I (27458) wifi: STA_DISCONNECTED, reason:201
no AP found
I (29508) wifi: STA_DISCONNECTED, reason:201
no AP found
I (30118) wifi: new:<5,0>, old:<1,0>, ap:<255,255>, sta:<5,0>, prof:1
I (30968) wifi: state: init -> auth (b0)
I (30968) wifi: state: auth -> assoc (0)
I (30988) wifi: state: assoc -> run (10)
I (31148) wifi: connected with Perisense2, channel 5, HT20, bssid = b0:39:56:4e:c1:ef
I (31148) wifi: pm start, type: 1

I (31148) network: CONNECTED
I (33048) event: sta ip: 10.0.0.2, mask: 255.255.255.0, gw: 10.0.0.1
I (33048) network: GOT_IP
WLAN Connected
Traceback (most recent call last):
  File "main.py", line 120, in <module>
  File "main.py", line 68, in mqtt_connect
  File "umqtt/simple.py", line 57, in connect
IndexError: list index out of range
MicroPython v1.12 on 2019-12-20; ESP32 module with ESP32
Type "help()" for more information.
On the other hand, both my home router and my phones mobile hotspot both result in the device behaving as expected.
Any ideas as to what would cause this to happen? Please let me know what additional details are needed.

User avatar
pythoncoder
Posts: 4466
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Different behavior with different routers

Post by pythoncoder » Fri Jan 10, 2020 6:40 pm

The library code is very poor in coping with connectivity outages. See resilient MQTT for a solution.
Peter Hinch

Post Reply