mirror of
https://github.com/esphome/esphome.git
synced 2026-09-21 20:18:43 +00:00
fix namespace conflicts
This commit is contained in:
@@ -77,11 +77,11 @@ WIFI_POWER_SAVE_MODES = {
|
||||
"HIGH": WiFiPowerSaveMode.WIFI_POWER_SAVE_HIGH,
|
||||
}
|
||||
|
||||
WiFiAuthMode = wifi_ns.enum("WiFiAuthMode")
|
||||
WIFI_AUTH_MODES = {
|
||||
"WPA": WiFiAuthMode.WIFI_AUTH_MODE_WPA,
|
||||
"WPA2": WiFiAuthMode.WIFI_AUTH_MODE_WPA2,
|
||||
"WPA3": WiFiAuthMode.WIFI_AUTH_MODE_WPA3,
|
||||
WifiMinAuthMode = wifi_ns.enum("WifiMinAuthMode")
|
||||
WIFI_MIN_AUTH_MODES = {
|
||||
"WPA": WifiMinAuthMode.WIFI_MIN_AUTH_MODE_WPA,
|
||||
"WPA2": WifiMinAuthMode.WIFI_MIN_AUTH_MODE_WPA2,
|
||||
"WPA3": WifiMinAuthMode.WIFI_MIN_AUTH_MODE_WPA3,
|
||||
}
|
||||
WiFiConnectedCondition = wifi_ns.class_("WiFiConnectedCondition", Condition)
|
||||
WiFiEnabledCondition = wifi_ns.class_("WiFiEnabledCondition", Condition)
|
||||
@@ -321,7 +321,7 @@ CONFIG_SCHEMA = cv.All(
|
||||
cv.Optional(CONF_FAST_CONNECT, default=False): cv.boolean,
|
||||
cv.Optional(CONF_USE_ADDRESS): cv.string_strict,
|
||||
cv.Optional(CONF_MIN_AUTH_MODE): cv.All(
|
||||
cv.enum(WIFI_AUTH_MODES, upper=True),
|
||||
cv.enum(WIFI_MIN_AUTH_MODES, upper=True),
|
||||
cv.only_on([Platform.ESP32, Platform.ESP8266]),
|
||||
),
|
||||
cv.SplitDefault(CONF_OUTPUT_POWER, esp8266=20.0): cv.All(
|
||||
|
||||
@@ -207,10 +207,10 @@ enum WiFiPowerSaveMode : uint8_t {
|
||||
WIFI_POWER_SAVE_HIGH,
|
||||
};
|
||||
|
||||
enum WiFiAuthMode : uint8_t {
|
||||
WIFI_AUTH_MODE_WPA = 0,
|
||||
WIFI_AUTH_MODE_WPA2,
|
||||
WIFI_AUTH_MODE_WPA3,
|
||||
enum WifiMinAuthMode : uint8_t {
|
||||
WIFI_MIN_AUTH_MODE_WPA = 0,
|
||||
WIFI_MIN_AUTH_MODE_WPA2,
|
||||
WIFI_MIN_AUTH_MODE_WPA3,
|
||||
};
|
||||
|
||||
#ifdef USE_ESP32
|
||||
@@ -264,7 +264,7 @@ class WiFiComponent : public Component {
|
||||
bool is_connected();
|
||||
|
||||
void set_power_save_mode(WiFiPowerSaveMode power_save);
|
||||
void set_min_auth_mode(WiFiAuthMode min_auth_mode) { min_auth_mode_ = min_auth_mode; }
|
||||
void set_min_auth_mode(WifiMinAuthMode min_auth_mode) { min_auth_mode_ = min_auth_mode; }
|
||||
void set_output_power(float output_power) { output_power_ = output_power; }
|
||||
|
||||
void set_passive_scan(bool passive);
|
||||
@@ -450,7 +450,7 @@ class WiFiComponent : public Component {
|
||||
// Group all 8-bit values together
|
||||
WiFiComponentState state_{WIFI_COMPONENT_STATE_OFF};
|
||||
WiFiPowerSaveMode power_save_{WIFI_POWER_SAVE_NONE};
|
||||
WiFiAuthMode min_auth_mode_{WIFI_AUTH_MODE_WPA2};
|
||||
WifiMinAuthMode min_auth_mode_{WIFI_MIN_AUTH_MODE_WPA2};
|
||||
uint8_t num_retried_{0};
|
||||
// Index into sta_ array for the currently selected AP configuration (-1 = none selected)
|
||||
// Used to access password, manual_ip, priority, EAP settings, and hidden flag
|
||||
|
||||
@@ -261,11 +261,11 @@ bool WiFiComponent::wifi_sta_connect_(const WiFiAP &ap) {
|
||||
// Set threshold based on configured minimum auth mode
|
||||
// Note: ESP8266 doesn't support WPA3
|
||||
switch (this->min_auth_mode_) {
|
||||
case WIFI_AUTH_MODE_WPA:
|
||||
case WIFI_MIN_AUTH_MODE_WPA:
|
||||
conf.threshold.authmode = AUTH_WPA_PSK;
|
||||
break;
|
||||
case WIFI_AUTH_MODE_WPA2:
|
||||
case WIFI_AUTH_MODE_WPA3: // Fall back to WPA2 for ESP8266
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -310,13 +310,13 @@ bool WiFiComponent::wifi_sta_connect_(const WiFiAP &ap) {
|
||||
} else {
|
||||
// Set threshold based on configured minimum auth mode
|
||||
switch (this->min_auth_mode_) {
|
||||
case WIFI_AUTH_MODE_WPA:
|
||||
case WIFI_MIN_AUTH_MODE_WPA:
|
||||
conf.sta.threshold.authmode = WIFI_AUTH_WPA_PSK;
|
||||
break;
|
||||
case WIFI_AUTH_MODE_WPA2:
|
||||
case WIFI_MIN_AUTH_MODE_WPA2:
|
||||
conf.sta.threshold.authmode = WIFI_AUTH_WPA2_PSK;
|
||||
break;
|
||||
case WIFI_AUTH_MODE_WPA3:
|
||||
case WIFI_MIN_AUTH_MODE_WPA3:
|
||||
conf.sta.threshold.authmode = WIFI_AUTH_WPA3_PSK;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user