Wifi reconnect takes a long time

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
lamama1234
Normal user
Posts: 10
Joined: 21 Aug 2021, 12:54

Wifi reconnect takes a long time

#1 Post by lamama1234 » 21 Aug 2021, 13:05

Hi,

I'm a newbie to ESPEasy, and tried to search for common issues in this forum but couldn't find.

I installed ESP_Easy_mega_20210503_normal_alt_wifi_ESP8266_4M1M on my ESP8266 NodeMCU and everything is working perfectly, except for the fact that when ESPEasy looses wifi connection (e.g. upon router restart), it takes forever to reconnect. Sometime up until 1 hr or more. RSSI is ~-73dbm so not super strong but still valid.

Are there any ESPEasy settings I can play with to make wifi reconnect faster?

thanks!
Screenshot 2021-08-21 140511.png
Screenshot 2021-08-21 140511.png (484.8 KiB) Viewed 7761 times

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Wifi reconnect takes a long time

#2 Post by Ath » 21 Aug 2021, 13:10

You should start by updating to the latest release of ESPEasy, 20210802, available from the releases page, that will greatly improve your WiFi connection, because of the many fixes that have been done since that May release.
The alt_wifi release should *only* be used if the normal release-build isn't working as expected.
/Ton (PayPal.me)

lamama1234
Normal user
Posts: 10
Joined: 21 Aug 2021, 12:54

Re: Wifi reconnect takes a long time

#3 Post by lamama1234 » 21 Aug 2021, 13:18

Ath wrote: 21 Aug 2021, 13:10 You should start by updating to the latest release of ESPEasy, 20210802, available from the releases page, that will greatly improve your WiFi connection, because of the many fixes that have been done since that May release.
The alt_wifi release should *only* be used if the normal release-build isn't working as expected.
Thanks. Can I update OTA? Also, once updating, will I need to re-define all previous devices/events?

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Wifi reconnect takes a long time

#4 Post by Ath » 21 Aug 2021, 13:37

lamama1234 wrote: 21 Aug 2021, 13:18 Can I update OTA?
Yes
lamama1234 wrote: 21 Aug 2021, 13:18 Also, once updating, will I need to re-define all previous devices/events?
No, if the Flash layout stays the same (4M1M) all settings will be preserved.
/Ton (PayPal.me)

lamama1234
Normal user
Posts: 10
Joined: 21 Aug 2021, 12:54

Re: Wifi reconnect takes a long time

#5 Post by lamama1234 » 21 Aug 2021, 13:47

Ath wrote: 21 Aug 2021, 13:37
lamama1234 wrote: 21 Aug 2021, 13:18 Can I update OTA?
Yes
lamama1234 wrote: 21 Aug 2021, 13:18 Also, once updating, will I need to re-define all previous devices/events?
No, if the Flash layout stays the same (4M1M) all settings will be preserved.
Many thanks!

lamama1234
Normal user
Posts: 10
Joined: 21 Aug 2021, 12:54

Re: Wifi reconnect takes a long time

#6 Post by lamama1234 » 26 Aug 2021, 13:37

Ath wrote: 21 Aug 2021, 13:10 You should start by updating to the latest release of ESPEasy, 20210802, available from the releases page, that will greatly improve your WiFi connection, because of the many fixes that have been done since that May release.
The alt_wifi release should *only* be used if the normal release-build isn't working as expected.
Hi again. I installed the latest available firmware:

ESP_Easy_mega_20210802_normal_ESP8266_4M1M Aug 2 2021

but still, reconnecting to wifi take a lot of time (>1 hr if at all).

Any other settings I can play with to fix that?

Thanks

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Wifi reconnect takes a long time

#7 Post by TD-er » 26 Aug 2021, 14:05

Can you be a bit more specific about your WiFi setup?
For example, are you using hidden SSID?
Is your WiFi configured to be a WiFi mesh?
Do you have lots of hidden SSID access points in your area (easiest to see on the /setup page or when performing a WiFi scan)

What configuration do you use in ESPEasy? (almost all in the last section of the Tools->Advanced page)

lamama1234
Normal user
Posts: 10
Joined: 21 Aug 2021, 12:54

Re: Wifi reconnect takes a long time

#8 Post by lamama1234 » 26 Aug 2021, 16:36

TD-er wrote: 26 Aug 2021, 14:05 Can you be a bit more specific about your WiFi setup?
For example, are you using hidden SSID?
Is your WiFi configured to be a WiFi mesh?
Do you have lots of hidden SSID access points in your area (easiest to see on the /setup page or when performing a WiFi scan)

What configuration do you use in ESPEasy? (almost all in the last section of the Tools->Advanced page)
Sure. I'm not using a hidden SSID and no other hidden SSIDs in my proximity.

I am using a mesh based system (Asus AiMesh with main router and one other node).

I'm also attaching my settings last section configuration:
IMG_20210826_173050.jpg
IMG_20210826_173050.jpg (294.43 KiB) Viewed 7603 times
IMG_20210826_173013.jpg
IMG_20210826_173013.jpg (299.67 KiB) Viewed 7603 times

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Wifi reconnect takes a long time

#9 Post by TD-er » 26 Aug 2021, 17:31

OK, that looks OK to me.
At least nothing I would immediately suggest to try.

About the WiFi mesh setup of your APs.
Given it is a WiFi mesh setup, maybe you can try to set the "Extra WiFi scan loops" to 1 or 2.
What this does, is the ESP will loop 2 or 3 times over all channels when a scan is needed.
This usually results in more found APs in a scan.
Maybe the "best" AP is not always found in a single scan and then the ESP may try to connect to the least favorable AP.

Do you have any setting like an RSSI threshold in the mesh configuration?
For example a settings which only allows a unit to connect if its RSSI is above some level.
If the ESP then always tries to connect to the "wrong" AP, the RSSI of the WiFI signal from the ESP may be too low and the other AP may report it does receive the same unit with a stronger signal.

Other settings to look for:
- Beacon interval. (Typically this is 102.4 msec, so if it differs, please tell)
- Some timeout settings. (sometimes expressed as a "distance" value or "near"/"far")

Rini52
Normal user
Posts: 47
Joined: 19 Jun 2021, 17:23
Location: NL

Re: Wifi reconnect takes a long time

#10 Post by Rini52 » 27 Aug 2021, 15:46

lamama1234 wrote: 26 Aug 2021, 16:36
TD-er wrote: 26 Aug 2021, 14:05 Can you be a bit more specific about your WiFi setup?
For example, are you using hidden SSID?
Is your WiFi configured to be a WiFi mesh?
Do you have lots of hidden SSID access points in your area (easiest to see on the /setup page or when performing a WiFi scan)

What configuration do you use in ESPEasy? (almost all in the last section of the Tools->Advanced page)
Sure. I'm not using a hidden SSID and no other hidden SSIDs in my proximity.

I am using a mesh based system (Asus AiMesh with main router and one other node).

I'm also attaching my settings last section configuration:

IMG_20210826_173050.jpg

IMG_20210826_173013.jpg
I also have a Asus mesh. Build a custom flash based on latest (202108) from TD, but use a static ip adress. This I find in previous test worked best to connect. I also include AP settings (prim+ Fallback) in the flash so it connects straight to the AP from a cold boot. This works most of the time. Indeed you have to check the db(RSSI) setting in the mess router that it doesn't disconnect if the strength falls below that value. It happen to me one time and than the only way to reconnect the ESP8266 is by cold reboot.

lamama1234
Normal user
Posts: 10
Joined: 21 Aug 2021, 12:54

Re: Wifi reconnect takes a long time

#11 Post by lamama1234 » 27 Aug 2021, 20:27

Rini52 wrote: 27 Aug 2021, 15:46
lamama1234 wrote: 26 Aug 2021, 16:36
TD-er wrote: 26 Aug 2021, 14:05 Can you be a bit more specific about your WiFi setup?
For example, are you using hidden SSID?
Is your WiFi configured to be a WiFi mesh?
Do you have lots of hidden SSID access points in your area (easiest to see on the /setup page or when performing a WiFi scan)

What configuration do you use in ESPEasy? (almost all in the last section of the Tools->Advanced page)
Sure. I'm not using a hidden SSID and no other hidden SSIDs in my proximity.

I am using a mesh based system (Asus AiMesh with main router and one other node).

I'm also attaching my settings last section configuration:

IMG_20210826_173050.jpg

IMG_20210826_173013.jpg
I also have a Asus mesh. Build a custom flash based on latest (202108) from TD, but use a static ip adress. This I find in previous test worked best to connect. I also include AP settings (prim+ Fallback) in the flash so it connects straight to the AP from a cold boot. This works most of the time. Indeed you have to check the db(RSSI) setting in the mess router that it doesn't disconnect if the strength falls below that value. It happen to me one time and than the only way to reconnect the ESP8266 is by cold reboot.
Thanks guys. I think I found a lead - it happens when my esp is changing connection from the main router (with better RSSI) to the other node. Through my mesh UI I am able to see my esp with the same ip as before, but it's web UI is unreachable and it doesn't communicate with my Domoticz server.

I will try to assign a static IP (at client side or router?) and see if it helps.

Thanks

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Wifi reconnect takes a long time

#12 Post by TD-er » 27 Aug 2021, 20:58

You may also want to send Gratuituous ARP packets from the ESP.
This may help other devices in your network to be able to reach the ESP.
... at least if the ESP is considering itself as connected.

It is possible the ESP does not complete all connect stages and then it may stay for a long time in such a limbo state.
Typically this happens if an event is not received in ESPEasy (event from the wifi layer, not related to the rules).
I have seen that happen sometimes, but I find it hard to reproduce.

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Wifi reconnect takes a long time

#13 Post by Ath » 27 Aug 2021, 21:06

The static IP should be set at ESPEasy, on the Config tab. You should fill all 4 fields of WiFi IP Settings, usually the Gateway and DNS are the IP address of the router, and the subnet mask will most likely be 255.255.255.0
/Ton (PayPal.me)

lamama1234
Normal user
Posts: 10
Joined: 21 Aug 2021, 12:54

Re: Wifi reconnect takes a long time

#14 Post by lamama1234 » 01 Sep 2021, 09:34

Thanks guys, seems to be working ok now.

Appreciate it!

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Wifi reconnect takes a long time

#15 Post by TD-er » 01 Sep 2021, 09:38

What was the fix?

lamama1234
Normal user
Posts: 10
Joined: 21 Aug 2021, 12:54

Re: Wifi reconnect takes a long time

#16 Post by lamama1234 » 01 Sep 2021, 09:47

TD-er wrote: 01 Sep 2021, 09:38 What was the fix?
I changed 3 things:

1. Fixed IP set by ESPEasy
2. Gratuituous ARP
3. Binded the unit to my main router (disabled roaming to node)

I will try to remove #2 and see if it still connects.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Wifi reconnect takes a long time

#17 Post by TD-er » 01 Sep 2021, 10:02

Gratuituous ARP has the function to tell the switches and APs in your network at what port one can reach the device with a specific MAC address.
So it will not fix (re)connecting to an AP, but it will help to find the node so other devices can communicate with it.
It may also fix reachability right after a node is connected to another AP.
But without Gratuituous ARP enabled, it will eventually appear reachable after some time.

The main problem with the ESP via WiFi is that it is not always receiving ARP requests, so it may not answer them.
Thus by proactively answering ARP requests, before they are even asked, you also tell the switches and APs in your network to store the MAC address in their MAC tables along with the port on which they heard the Gratuituous ARP (or normal ARP reply) packet

lamama1234
Normal user
Posts: 10
Joined: 21 Aug 2021, 12:54

Re: Wifi reconnect takes a long time

#18 Post by lamama1234 » 01 Sep 2021, 11:52

TD-er wrote: 01 Sep 2021, 10:02 Gratuituous ARP has the function to tell the switches and APs in your network at what port one can reach the device with a specific MAC address.
So it will not fix (re)connecting to an AP, but it will help to find the node so other devices can communicate with it.
It may also fix reachability right after a node is connected to another AP.
But without Gratuituous ARP enabled, it will eventually appear reachable after some time.

The main problem with the ESP via WiFi is that it is not always receiving ARP requests, so it may not answer them.
Thus by proactively answering ARP requests, before they are even asked, you also tell the switches and APs in your network to store the MAC address in their MAC tables along with the port on which they heard the Gratuituous ARP (or normal ARP reply) packet
Got it. I mainly need my ESP to send out data so probably won't be affected much by cancelling Gratuituous ARP. I will give it a try and report back.

Tnx again

lamama1234
Normal user
Posts: 10
Joined: 21 Aug 2021, 12:54

Re: Wifi reconnect takes a long time

#19 Post by lamama1234 » 09 Sep 2021, 13:58

Just as a follow-up, cancelling Gratuituous ARP didn't affect connectivity. Everything is working ok now. Thanks everybody!

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Wifi reconnect takes a long time

#20 Post by TD-er » 09 Sep 2021, 23:26

Thanks for the update

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 25 guests