I have searched for solution for this issue for quite a long time with no luck.
I would like NodeMCU to look for an open wifi network and connect to it. As long as the connection is available use that connection - and when the connection drops start looking for a new open network.
I live in Finland and we have free open WiFi almost on every corner. I am planning on creating something wearable/mobile that would use WiFi when available.
I am also only starting on programming, basics in C and using the Arduino IDE so no Lua language experience here.
I understand that WiFi.scanNetworks()
can distinguish a secure from an unsecured SSID, but I haven't found out how I could use that to my advantage in Arduino IDE.
You can scan for networks also in STA mode.
The method you need is
WiFi.encryptionType()
afterWiFi.scanNetworks()
to determine whether a network encrypted or not.I am sharing a sketch with you that I was working on for a similar project previously.
Sketch searches for WiFi networks, sorts them in order to RSSI, and performs connection on non-encrypted one with highest strength.
Here it is, good luck: