-
Notifications
You must be signed in to change notification settings - Fork 639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Periodically scan WiFi networks find the best one #2064
Comments
This would be useful. I used to have the access point at the bottom of my garden reboot at night. The devices near it would connect to the weaker AP of the same ssid, and never re connect to the stronger signal. A reboot would sometimes be required as I couldn't reliably get to the webUI. Personally, I know I shouldn't have to, but a device reboot auto scheduled for say, every week or so would be good. Very occasionally I'll have a device that stops responding and it needs a reboot. |
I was suggesting only a wifi reconnect of the "espurna" device; I have a similar scenario to yours. If I reboot the AP, when the espurna device connects to the lower strengh AP, TCP manages to work, NTP (UDP) does not manage to sync, and the scheduling of the espurna devices does not work. |
Maybe related to xoseperez/justwifi#17 as well, but I am not sure about the
On what condition? RSSI below certain threshold? Or it needs to remember best RSSI variable across re-connections instead of just at the moment of scan and try to match it again? |
Can the device do a scan every say, 10/15 mins. If it finds more than one ssid of the same name, connect to the stronger one. If another known ssid is configured and stronger, connect to that one. If already connected to the strongest ssid out of the ones configured, don't do anything. |
I was thinking on using it to do a full reconnect to the wifi each hour. This should not hurt too much. It would trigger a mqtt reconnect, an ntp reconnect, a dhcp refresh, etc,... |
Sure, but I am leaning towards periodic scan. The only issue is with JustWifi expecting it to always happen as part of the connection loop, thus it needs to learn to do it whenever we want to and update internal networks rating with new BSSID based on RSSI values. Then it is just a matter of disconnecting from the current AP and the connection loop will automatically choose a better one when deciding which network to pick. Regarding Core versions and AP problems (Mikrotik?), that's just a workaround. And I would expect Core versions 2.6.2+ to behave much better than 2.3.0 if you having issues with unresponsive devices. Another option is to have forced BSSID & channel as part of the settings, so it will never pick up a wrong AP |
I am recompiling the code of 1.14.0 myself and using 2.6.2, However even if using 2.6.2 and discarding connectivity problems from the wifi stack of the Core version, this functionality would be still useful (reconnect at cyclic intervals). I observe that many esp devices stay connected to SSID with lower RSSI. Imagine, an apartment block with APs from neighbors with a scheduled on/off wireless. The list of SSIDS, the channel occupancy, and what SSID/BSSID is in what channel fluctuate quite often. I force the channel in my APs to mitigate this. For a force "BSSID & channel", is the same that having independent SSID per AP. |
By stuck you mean they loose connection and never connect again or loose IP but keep the connection (#614, supposed fix by the #1877)? My only issue with forced disconnect before any scanning is possible loss of any connection, as I do routinely see esp8266 missing the target SSID in an apartment WiFi environment with a lot of other APs, despite it being 2 meters between them. JustWifi needs to be changed for this change too, to force to reconnect back in case we have not found any new networks |
I am using 2.6.2 and have connectivity issues. It is much better than 2.30, but still happen with certain APs |
What I meant is try out a different WiFi SDK included by the Core. Default is july's, but Espressif claims to have fixed some connectivity issues in the november one. Script source that I linked checks for a specific C defines that a supposed to go into the How do these connectivity issues manifest? On the topic... I am still trying out different approaches for scanning. |
Hello, I would like to clarify the topics:
|
Yes, sorry for offtopic. When you do have some more info about build configuration, please do report that in a separate issue. I hope we can figure out some way to avoid those. For the issue at hand, I need some real device to test things first, as I just played around with justwifi state machine so far. Will push an update asap |
WRT this topic, can the RPN rules be used here? Either using RSSI value as a trigger, uptime or daily at a specific time and run the terminal command |
I tried to check the documentation on RPN... But there is the need of a global counter to store the last reconnect (for example copying the uptime value) and execute terminal commands. Any of the features are implemented in RPN. |
See #2088 JustWifi callback now sends Right now it will compare new RSSI with the current one and if the difference is >= 20 ( Have not tested besides dummy host program in justwifi test folder and a very quick test with 2 APs |
Regarding RPN, it is true that the should be some temporary storage for some temporary statistics. There are variables, but I don't see any way to store variables from rule, only way is through MQTT topics. I guess a basic |
* see #2088 to fix bug in JustWifi branch, when scan function immediately disconnected STA |
Any feedback for the #2088 so far? 👀 |
I have recompiled 1.14.1 with this branch https://github.com/mcspr/justwifi.git#better-networks the justwifi library and core 2.6.3 I notice an overall improvement with the situation. However, I notice that some devices get disconnected and are unable to reconnect properly to the wifi. I see in the monitoring logs that they try to reconnect each 10-15 min but they are unable to stay connected. The AP is 3m far away with good RSSI. Unplugging and replugging the device solves the situation. It seems that there are still issues with Core 2.6.3. However with ESPEasy, and custom developments I do not get this issue. In last both cases I force a reconnect each hour. Also I notice some Espurna devices that are unable to connect to MQTT. NTP is connected. I force a MQTT.reset command via telnet and does not have any improvment. Sometimes a Wifi reset command works, and afterwards there is mqtt connectivity, other times there is need of a full reset. |
Do you mean that you used #2088 changes on top of the 1.14.1? Which scan time have you used? Any other settings related to wifi? Not sure what you meant bc library itself does not trigger re-connection, espurna needs to handle specific message from justwifi when it finds the network with better rssi. Any specific characteristic of those devices (vendor, board type, location etc.)? Are they loosing the connection after periodic scan added in the new justwifi branch or do you mean router logs? espurna/code/espurna/config/general.h Line 457 in 62ad7da
Lines 105 to 108 in 62ad7da
( wifiSleep 0 for NONE, 1 for LIGHT and 2 for MODEM, light one is tricky performance-wise though)https://github.com/letscontrolit/ESPEasy/blob/b747fa571ef77f0f82ffa77997fbba7a2e140837/src/Custom-sample.h#L60 |
I use sonoff devices (pow, pow2, rfbrdige, s20, slampher) I use espurna 1.14.1 + justwifi branch xoseperez/justwifi@master...mcspr:better-networks + SDK version 2.2.2-dev(38a443e) + Core version 2.6.3 BTW, the SDK version message in the web UI main page could be modified to use ESP.getFullVersion() instead of ESP.getSdkVersion() |
That's what I meant - looking at iot-plug-office-printer.randomizer.space.json.txt there is no But I still need to look at justwifi again to make sure it does not lock things somehow so new networks appear. |
I have synced #2088 with the dev and set default to 3 minute scan interval. So far my understanding was that the scanning works and it does not cause any serious issues with the existing connectivity (since network stack is busy flipping channels, not managing any traffic). Any updates on reliability of the whole thing? I assume the OT SDK issues were solved in the meantime |
note of the https://gitter.im/tinkerman-cat/espurna?at=6072fa89969f8b38ee702b4f per #2088 and the recent commits, that should be fixed |
Implement a new functionality to force a wireless reconnection each X seconds.
In a wireless environment with several APs with same ssid, I enable wifiScan.
However the devices stay connected to the first AP they connected.
If a new AP with better RSSI is activated, devices do not change BSSID. They never connect to this new AP.
With this feature each X seconds devices will force a reconnect and use the wifiScan algorithm to connect to the AP with best RSSI.
This scenario also happens if one of the APs is rebooted. Devices reconnect to another AP with a low stability link, but they never connect back to the best AP.
The text was updated successfully, but these errors were encountered: