Closed
Description
Board
ESP32 boards
Device Description
Any ESP32
Hardware Configuration
Basic chip with WiFi, using WifiMulti
Version
latest master (checkout manually)
IDE Name
PlatformIO
Operating System
MacOS 13.3
Flash frequency
40Mhz
PSRAM enabled
yes
Upload speed
115200
Description
When WiFi.scanNetworks runs, the results for networks that are hidden is to not return an SSID name. RSSI, BSSID, and other info is returned but no SSID.
When the APList items are compared to the SSID of that hidden network:
for(uint32_t x = APlist.size() ; x > 0; x--) {
WifiAPlist_t entry = APlist[x-1];
if(ssid_scan == entry.ssid) { // SSID match <======= For SSIDs that are hidden, ssid_scan is ""
…
}
There won't be a match. If we pass our SSID to WiFi.begin("hidden ssid name", "password");
that will work, but not with WiFiMulti.run()
as the ssid added via WiFiMulti.addAP("hidden ssid name", "password") will never match the empty string that results from the scan.
Sketch
/*
* This sketch trys to Connect to the best AP based on a given list
*
*/
#include <WiFi.h>
#include <WiFiMulti.h>
WiFiMulti wifiMulti;
void setup()
{
Serial.begin(115200);
delay(10);
wifiMulti.addAP("hidden_SSID", "password1"); <=== This network never gets selected despite that AP is the stronger one. The AP is set to hide that network SSID.
wifiMulti.addAP("ssid_2", "password2");
Serial.println("Connecting Wifi...");
if(wifiMulti.run() == WL_CONNECTED) {
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
}
void loop()
{
if(wifiMulti.run() != WL_CONNECTED) {
Serial.println("WiFi not connected!");
delay(1000);
}
}
Debug Message
Here is an output of a wifi scan. The first network is not hidden, and the second one is. Both networks are resident on the same AP (which somewhat explains the oddly similar BSSIDs).
[ 5935][I][KiniNetworking.cpp:820] wifi_scan(): [scan] SSID Kini Test Net
[ 5942][I][KiniNetworking.cpp:821] wifi_scan(): [scan] RSSI -56
[ 5948][I][KiniNetworking.cpp:823] wifi_scan(): [scan] BSSID 18:E8:29:57:B5:4A
[ 5955][I][KiniNetworking.cpp:721] print_auth_mode(): [scan] Authmode WIFI_AUTH_WPA2_PSK
[ 5963][I][KiniNetworking.cpp:756] print_cipher_type(): [scan] Pairwise Cipher WIFI_CIPHER_TYPE_CCMP
[ 5972][I][KiniNetworking.cpp:780] print_cipher_type(): [scan] Group Cipher WIFI_CIPHER_TYPE_CCMP
[ 5981][I][KiniNetworking.cpp:828] wifi_scan(): [scan] Channel 1
[ 5987][I][KiniNetworking.cpp:820] wifi_scan(): [scan] SSID
[ 5992][I][KiniNetworking.cpp:821] wifi_scan(): [scan] RSSI -59
[ 5998][I][KiniNetworking.cpp:823] wifi_scan(): [scan] BSSID 1E:E8:29:57:B5:4A
[ 6005][I][KiniNetworking.cpp:721] print_auth_mode(): [scan] Authmode WIFI_AUTH_WPA2_PSK
[ 6013][I][KiniNetworking.cpp:756] print_cipher_type(): [scan] Pairwise Cipher WIFI_CIPHER_TYPE_CCMP
[ 6022][I][KiniNetworking.cpp:780] print_cipher_type(): [scan] Group Cipher WIFI_CIPHER_TYPE_CCMP
[ 6031][I][KiniNetworking.cpp:828] wifi_scan(): [scan] Channel 1
Other Steps to Reproduce
Use WiFi.scanNetworks in an environment where you have hidden and unhidden SSID.
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.
Metadata
Metadata
Assignees
Type
Projects
Status
Done