1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-19 08:15:49 +00:00

[wifi] Add min_auth_mode configuration option (#11814)

This commit is contained in:
J. Nick Koston
2025-11-11 16:39:55 -06:00
committed by GitHub
parent 00c71b7236
commit 65a303d48f
6 changed files with 79 additions and 6 deletions

View File

@@ -258,8 +258,17 @@ bool WiFiComponent::wifi_sta_connect_(const WiFiAP &ap) {
if (ap.get_password().empty()) {
conf.threshold.authmode = AUTH_OPEN;
} else {
// Only allow auth modes with at least WPA
conf.threshold.authmode = AUTH_WPA_PSK;
// Set threshold based on configured minimum auth mode
// Note: ESP8266 doesn't support WPA3
switch (this->min_auth_mode_) {
case WIFI_MIN_AUTH_MODE_WPA:
conf.threshold.authmode = AUTH_WPA_PSK;
break;
case WIFI_MIN_AUTH_MODE_WPA2:
case WIFI_MIN_AUTH_MODE_WPA3: // Fall back to WPA2 for ESP8266
conf.threshold.authmode = AUTH_WPA2_PSK;
break;
}
}
conf.threshold.rssi = -127;
#endif