[GH-ISSUE #1646] Autoreconnect doesn't work due to _arduino_event_cb(): STA Got Same IP #1399

Open
opened 2026-02-28 01:29:55 +03:00 by kerem · 9 comments
Owner

Originally created by @Dario-Ciceri on GitHub (Aug 19, 2023).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1646

[ 57622][V][WiFiGeneric.cpp:367] _arduino_event_cb(): STA Got Same IP:192.168.173.158
11:35:48.219 -> Got time adjustment from NTP!
11:35:49.962 -> *wm:AutoConnect: FAILED

Hi, I noticed that even if ESP32 connects to WiFi, switching from ethernet module, wifi manager will say *wm:AutoConnect: FAILED
but ESP32 is successfully connected...

Originally created by @Dario-Ciceri on GitHub (Aug 19, 2023). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1646 [ 57622][V][WiFiGeneric.cpp:367] _arduino_event_cb(): STA Got Same IP:192.168.173.158 11:35:48.219 -> Got time adjustment from NTP! 11:35:49.962 -> *wm:AutoConnect: FAILED Hi, I noticed that even if ESP32 connects to WiFi, switching from ethernet module, wifi manager will say *wm:AutoConnect: FAILED but ESP32 is successfully connected...
Author
Owner

@tablatronix commented on GitHub (Aug 19, 2023):

Interesting

<!-- gh-comment-id:1684937144 --> @tablatronix commented on GitHub (Aug 19, 2023): Interesting
Author
Owner

@Dario-Ciceri commented on GitHub (Aug 19, 2023):

I don't know if there's a way to "reset" WiFi and avoid STA Got Same IP by erasing the previous one... I tried many esp API calls but nothing works, even deinit and init again doesn't work...
If I reset esp32 it connects without problem and I think it's because it doesn't have "a previous ip"

P.S. with WiFi.reconnect it works even with same IP so it must be WiFiManager library (?)
I know there's a flag "connected" which is set true only by if (WiFi.status() == WL_CONNECTED) { connected = true; #ifdef WM_DEBUG_LEVEL DEBUG_WM(F("AutoConnect: ESP Already Connected")); #endif setSTAConfig(); // @todo not sure if this is safe, causes dup setSTAConfig in connectwifi, // and we have no idea WHAT we are connected to }

maybe this piece of code if (connected || connectWifi(_defaultssid, _defaultpass) == WL_CONNECTED) { //connected #ifdef WM_DEBUG_LEVEL DEBUG_WM(F("AutoConnect: SUCCESS")); DEBUG_WM(DEBUG_VERBOSE, F("Connected in"), (String)((millis() - _startconn)) + " ms"); DEBUG_WM(F("STA IP Address:"), WiFi.localIP()); #endif doesn't detect same ip event? but shouldn't WL_CONNECTED works just fine? Maybe if we could set WL_CONNECTED on STA Got Same IP it could works fine

<!-- gh-comment-id:1684939898 --> @Dario-Ciceri commented on GitHub (Aug 19, 2023): I don't know if there's a way to "reset" WiFi and avoid STA Got Same IP by erasing the previous one... I tried many esp API calls but nothing works, even deinit and init again doesn't work... If I reset esp32 it connects without problem and I think it's because it doesn't have "a previous ip" P.S. with WiFi.reconnect it works even with same IP so it must be WiFiManager library (?) I know there's a flag "connected" which is set true only by `if (WiFi.status() == WL_CONNECTED) { connected = true; #ifdef WM_DEBUG_LEVEL DEBUG_WM(F("AutoConnect: ESP Already Connected")); #endif setSTAConfig(); // @todo not sure if this is safe, causes dup setSTAConfig in connectwifi, // and we have no idea WHAT we are connected to }` maybe this piece of code `if (connected || connectWifi(_defaultssid, _defaultpass) == WL_CONNECTED) { //connected #ifdef WM_DEBUG_LEVEL DEBUG_WM(F("AutoConnect: SUCCESS")); DEBUG_WM(DEBUG_VERBOSE, F("Connected in"), (String)((millis() - _startconn)) + " ms"); DEBUG_WM(F("STA IP Address:"), WiFi.localIP()); #endif` doesn't detect same ip event? but shouldn't WL_CONNECTED works just fine? Maybe if we could set WL_CONNECTED on STA Got Same IP it could works fine
Author
Owner

@tablatronix commented on GitHub (Aug 19, 2023):

Sounds like it might be an ESP lib issue, either way I will see if we can workaround it

is [ 57622][V][WiFiGeneric.cpp:367] _arduino_event_cb(): STA Got Same IP:192.168.173.158
the only event you see?

I wonder if switching ap to ap would also do this?

<!-- gh-comment-id:1684943919 --> @tablatronix commented on GitHub (Aug 19, 2023): Sounds like it might be an ESP lib issue, either way I will see if we can workaround it is [ 57622][V][WiFiGeneric.cpp:367] _arduino_event_cb(): STA Got Same IP:192.168.173.158 the only event you see? I wonder if switching ap to ap would also do this?
Author
Owner

@Dario-Ciceri commented on GitHub (Aug 19, 2023):

Sounds like it might be an ESP lib issue, either way I will see if we can workaround it

is [ 57622][V][WiFiGeneric.cpp:367] _arduino_event_cb(): STA Got Same IP:192.168.173.158 the only event you see?

I wonder if switching ap to ap would also do this?

Yes and routine stuff like STA disconnected, start etc due to wifimanager behaviour

Switching from ap to ap? Idk, honestly it would be weird if different AP same IP no?

<!-- gh-comment-id:1684944997 --> @Dario-Ciceri commented on GitHub (Aug 19, 2023): > Sounds like it might be an ESP lib issue, either way I will see if we can workaround it > > is [ 57622][V][WiFiGeneric.cpp:367] _arduino_event_cb(): STA Got Same IP:192.168.173.158 the only event you see? > > I wonder if switching ap to ap would also do this? Yes and routine stuff like STA disconnected, start etc due to wifimanager behaviour Switching from ap to ap? Idk, honestly it would be weird if different AP same IP no?
Author
Owner

@Dario-Ciceri commented on GitHub (Aug 19, 2023):

Sounds like it might be an ESP lib issue, either way I will see if we can workaround it
is [ 57622][V][WiFiGeneric.cpp:367] _arduino_event_cb(): STA Got Same IP:192.168.173.158 the only event you see?
I wonder if switching ap to ap would also do this?

Yes and routine stuff like STA disconnected, start etc due to wifimanager behaviour

Switching from ap to ap? Idk, honestly it would be weird if different AP same IP no?

oh and also, sometimes a weird error which seems related to // if retry without delay (via begin()), the IDF is still busy even after returning status // E (5130) wifi:sta is connecting, return error // [E][WiFiSTA.cpp:221] begin(): connect failed! but even with if (_aggresiveReconn) delay(1000); sometimes I get // E (5130) wifi:sta is connecting, return error // [E][WiFiSTA.cpp:221] begin(): connect failed!

<!-- gh-comment-id:1684945571 --> @Dario-Ciceri commented on GitHub (Aug 19, 2023): > > Sounds like it might be an ESP lib issue, either way I will see if we can workaround it > > is [ 57622][V][WiFiGeneric.cpp:367] _arduino_event_cb(): STA Got Same IP:192.168.173.158 the only event you see? > > I wonder if switching ap to ap would also do this? > > Yes and routine stuff like STA disconnected, start etc due to wifimanager behaviour > > Switching from ap to ap? Idk, honestly it would be weird if different AP same IP no? oh and also, sometimes a weird error which seems related to ` // if retry without delay (via begin()), the IDF is still busy even after returning status // E (5130) wifi:sta is connecting, return error // [E][WiFiSTA.cpp:221] begin(): connect failed! ` but even with `if (_aggresiveReconn) delay(1000);` sometimes I get `// E (5130) wifi:sta is connecting, return error // [E][WiFiSTA.cpp:221] begin(): connect failed!`
Author
Owner

@Dario-Ciceri commented on GitHub (Aug 19, 2023):

could you also tell me what's causing hostByName(): DNS Failed for www.google.com ?

I'll follow this: https://github.com/espressif/arduino-esp32/issues/1595#issuecomment-429435687

It seems to work, well I was using a task on core 0 with priority 10... but I never heard of this problem before... maybe it's causing problem with wifimanager too, like not letting events to be detected?

<!-- gh-comment-id:1684985912 --> @Dario-Ciceri commented on GitHub (Aug 19, 2023): could you also tell me what's causing hostByName(): DNS Failed for www.google.com ? I'll follow this: https://github.com/espressif/arduino-esp32/issues/1595#issuecomment-429435687 It seems to work, well I was using a task on core 0 with priority 10... but I never heard of this problem before... maybe it's causing problem with wifimanager too, like not letting events to be detected?
Author
Owner

@tablatronix commented on GitHub (Aug 20, 2023):

What esp version are you using ?

<!-- gh-comment-id:1685137011 --> @tablatronix commented on GitHub (Aug 20, 2023): What esp version are you using ?
Author
Owner

@Dario-Ciceri commented on GitHub (Aug 21, 2023):

What esp version are you using ?

Dev Module, 2.0.4

<!-- gh-comment-id:1686298397 --> @Dario-Ciceri commented on GitHub (Aug 21, 2023): > What esp version are you using ? Dev Module, 2.0.4
Author
Owner

@Dario-Ciceri commented on GitHub (Aug 30, 2023):

ehy @tablatronix I think I found the problem, look here please: https://github.com/espressif/arduino-esp32/issues/653#issuecomment-755851929

and here: https://github.com/espressif/arduino-esp32/issues/1100#issuecomment-392397250

currently I've upgraded to 2.0.11

<!-- gh-comment-id:1699837230 --> @Dario-Ciceri commented on GitHub (Aug 30, 2023): ehy @tablatronix I think I found the problem, look here please: https://github.com/espressif/arduino-esp32/issues/653#issuecomment-755851929 and here: https://github.com/espressif/arduino-esp32/issues/1100#issuecomment-392397250 currently I've upgraded to 2.0.11
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#1399
No description provided.