7#if (ESP_IDF_VERSION_MAJOR >= 5 && ESP_IDF_VERSION_MINOR >= 1)
8#include <esp_eap_client.h>
18#include <user_interface.h>
32#ifdef USE_CAPTIVE_PORTAL
43static const char *
const TAG =
"wifi";
147static const LogString *retry_phase_to_log_string(
WiFiRetryPhase phase) {
150 return LOG_STR(
"INITIAL_CONNECT");
151#ifdef USE_WIFI_FAST_CONNECT
153 return LOG_STR(
"FAST_CONNECT_CYCLING");
156 return LOG_STR(
"EXPLICIT_HIDDEN");
158 return LOG_STR(
"SCAN_CONNECTING");
160 return LOG_STR(
"RETRY_HIDDEN");
162 return LOG_STR(
"RESTARTING");
164 return LOG_STR(
"UNKNOWN");
171 return !this->
sta_.empty() && this->
sta_[0].get_hidden();
177 for (
size_t i = 0; i < this->
sta_.size(); i++) {
178 if (!this->
sta_[i].get_hidden()) {
179 return static_cast<int8_t
>(i);
190static constexpr uint8_t WIFI_RETRY_COUNT_PER_BSSID = 2;
194static constexpr uint8_t WIFI_RETRY_COUNT_PER_SSID = 1;
198static constexpr uint8_t WIFI_RETRY_COUNT_PER_AP = 1;
202static constexpr uint32_t WIFI_COOLDOWN_DURATION_MS = 500;
207static constexpr uint32_t WIFI_COOLDOWN_WITH_AP_ACTIVE_MS = 30000;
209static constexpr uint8_t get_max_retries_for_phase(
WiFiRetryPhase phase) {
212#ifdef USE_WIFI_FAST_CONNECT
216 return WIFI_RETRY_COUNT_PER_AP;
219 return WIFI_RETRY_COUNT_PER_SSID;
222 return WIFI_RETRY_COUNT_PER_BSSID;
225 return WIFI_RETRY_COUNT_PER_SSID;
227 return WIFI_RETRY_COUNT_PER_BSSID;
231static void apply_scan_result_to_params(WiFiAP ¶ms,
const WiFiScanResult &scan) {
232 params.set_hidden(
false);
233 params.set_ssid(scan.get_ssid());
234 params.set_bssid(scan.get_bssid());
235 params.set_channel(scan.get_channel());
250 for (
const auto &conf : this->
sta_) {
251 if (conf.get_ssid() == ssid && conf.get_hidden()) {
258 if (scan.get_ssid() == ssid) {
269 for (
size_t i = start_index + 1; i < this->
sta_.size(); i++) {
270 const auto &sta = this->
sta_[i];
275 if (!include_explicit_hidden && sta.get_hidden()) {
277 if (first_non_hidden_idx < 0 ||
static_cast<int8_t
>(i) < first_non_hidden_idx) {
278 ESP_LOGD(TAG,
"Skipping " LOG_SECRET(
"'%s'")
" (explicit hidden, already tried)", sta.get_ssid().c_str());
286 ESP_LOGD(TAG,
"Hidden candidate " LOG_SECRET(
"'%s'")
" at index %d", sta.get_ssid().c_str(),
static_cast<int>(i));
287 return static_cast<int8_t
>(i);
289 ESP_LOGD(TAG,
"Skipping hidden retry for visible network " LOG_SECRET(
"'%s'"), sta.get_ssid().c_str());
298 if (!this->
sta_.empty() && this->sta_[0].get_hidden()) {
299 ESP_LOGI(TAG,
"Starting with explicit hidden network (highest priority)");
305 ESP_LOGI(TAG,
"Starting scan");
310#if defined(USE_ESP32) && defined(USE_WIFI_WPA2_EAP) && ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
311static const char *eap_phase2_to_str(esp_eap_ttls_phase2_types
type) {
313 case ESP_EAP_TTLS_PHASE2_PAP:
315 case ESP_EAP_TTLS_PHASE2_CHAP:
317 case ESP_EAP_TTLS_PHASE2_MSCHAP:
319 case ESP_EAP_TTLS_PHASE2_MSCHAPV2:
321 case ESP_EAP_TTLS_PHASE2_EAP:
353#ifdef USE_WIFI_FAST_CONNECT
359 ESP_LOGD(TAG,
"Loaded settings: %s", save.ssid);
363 sta.set_password(save.password);
370 ESP_LOGV(TAG,
"Setting Output Power Option failed");
374 ESP_LOGV(TAG,
"Setting Power Save Option failed");
378#ifdef USE_WIFI_FAST_CONNECT
383 if (loaded_fast_connect) {
384 ESP_LOGI(TAG,
"Starting fast_connect (saved) " LOG_SECRET(
"'%s'"), params.
get_ssid().c_str());
386 }
else if (!this->
sta_.empty() && !this->sta_[0].get_hidden()) {
388 ESP_LOGI(TAG,
"Starting fast_connect (config) " LOG_SECRET(
"'%s'"), this->
sta_[0].get_ssid().c_str());
401 }
else if (this->
has_ap()) {
404 ESP_LOGV(TAG,
"Setting Output Power Option failed");
406#ifdef USE_CAPTIVE_PORTAL
425 ESP_LOGW(TAG,
"Restarting adapter");
455 uint32_t cooldown_duration = portal_active ? WIFI_COOLDOWN_WITH_AP_ACTIVE_MS : WIFI_COOLDOWN_DURATION_MS;
478 ESP_LOGW(TAG,
"Connection lost; reconnecting");
499 ESP_LOGI(TAG,
"Starting fallback AP");
501#ifdef USE_CAPTIVE_PORTAL
522 ESP_LOGE(TAG,
"Can't connect; rebooting");
533#ifdef USE_WIFI_11KV_SUPPORT
567 if (name.length() > 32) {
570 name.erase(25, name.length() - 32);
583 " AP Password: '%s'\n"
585 this->
ap_.
get_ssid().c_str(), this->ap_.get_password().c_str(), ip_address.c_str());
587#ifdef USE_WIFI_MANUAL_IP
589 if (manual_ip.has_value()) {
591 " AP Static IP: '%s'\n"
592 " AP Gateway: '%s'\n"
594 manual_ip->static_ip.str().c_str(), manual_ip->gateway.str().c_str(),
595 manual_ip->subnet.str().c_str());
627 if (config ==
nullptr) {
628 ESP_LOGE(TAG,
"No valid network config (selected_sta_index_=%d, sta_.size()=%zu)",
638#ifdef USE_WIFI_FAST_CONNECT
656 apply_scan_result_to_params(params, this->
scan_result_[0]);
670 return config ? *config :
WiFiAP{};
674 strncpy(save.ssid, ssid.c_str(),
sizeof(save.ssid) - 1);
675 strncpy(save.password, password.c_str(),
sizeof(save.password) - 1);
682 sta.set_password(password);
692 ESP_LOGD(TAG,
"Exiting cooldown early due to new WiFi credentials");
699 std::string bssid_formatted;
708 "Connecting to " LOG_SECRET(
"'%s'")
" " LOG_SECRET(
"(%s)")
" (priority %d, attempt %u/%u in phase %s)...",
711 LOG_STR_ARG(retry_phase_to_log_string(this->
retry_phase_)));
713#ifdef ESPHOME_LOG_HAS_VERBOSE
714 ESP_LOGV(TAG,
"Connection Params:");
715 ESP_LOGV(TAG,
" SSID: '%s'", ap.
get_ssid().c_str());
719 ESP_LOGV(TAG,
" BSSID: Not Set");
722#ifdef USE_WIFI_WPA2_EAP
723 if (ap.
get_eap().has_value()) {
724 ESP_LOGV(TAG,
" WPA2 Enterprise authentication configured:");
726 ESP_LOGV(TAG,
" Identity: " LOG_SECRET(
"'%s'"), eap_config.
identity.c_str());
727 ESP_LOGV(TAG,
" Username: " LOG_SECRET(
"'%s'"), eap_config.
username.c_str());
728 ESP_LOGV(TAG,
" Password: " LOG_SECRET(
"'%s'"), eap_config.
password.c_str());
729#if defined(USE_ESP32) && defined(USE_WIFI_WPA2_EAP) && ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
730 ESP_LOGV(TAG,
" TTLS Phase 2: " LOG_SECRET(
"'%s'"), eap_phase2_to_str(eap_config.
ttls_phase_2));
732 bool ca_cert_present = eap_config.
ca_cert !=
nullptr && strlen(eap_config.
ca_cert);
735 ESP_LOGV(TAG,
" CA Cert: %s", ca_cert_present ?
"present" :
"not present");
736 ESP_LOGV(TAG,
" Client Cert: %s", client_cert_present ?
"present" :
"not present");
737 ESP_LOGV(TAG,
" Client Key: %s", client_key_present ?
"present" :
"not present");
740 ESP_LOGV(TAG,
" Password: " LOG_SECRET(
"'%s'"), ap.
get_password().c_str());
741#ifdef USE_WIFI_WPA2_EAP
747 ESP_LOGV(TAG,
" Channel not set");
749#ifdef USE_WIFI_MANUAL_IP
752 ESP_LOGV(TAG,
" Manual IP: Static IP=%s Gateway=%s Subnet=%s DNS1=%s DNS2=%s",
m.static_ip.str().c_str(),
753 m.gateway.str().c_str(),
m.subnet.str().c_str(),
m.dns1.str().c_str(),
m.dns2.str().c_str());
757 ESP_LOGV(TAG,
" Using DHCP IP");
759 ESP_LOGV(TAG,
" Hidden: %s", YESNO(ap.
get_hidden()));
763 ESP_LOGE(TAG,
"wifi_sta_connect_ failed");
775 if (rssi == WIFI_RSSI_DISCONNECTED) {
778 return LOG_STR(
"\033[0;31m"
779 "\xc3\x97\xc3\x97\xc3\x97\xc3\x97"
791 return LOG_STR(
"\033[0;32m"
797 }
else if (rssi >= -65) {
798 return LOG_STR(
"\033[0;33m"
805 }
else if (rssi >= -85) {
806 return LOG_STR(
"\033[0;33m"
814 return LOG_STR(
"\033[0;31m"
829 ESP_LOGCONFIG(TAG,
" Disabled");
834 ESP_LOGCONFIG(TAG,
" IP Address: %s", ip.str().c_str());
839 " SSID: " LOG_SECRET(
"'%s'")
"\n"
840 " BSSID: " LOG_SECRET(
"%s")
"\n"
842 " Signal strength: %d dB %s\n"
843 " Channel: %" PRId32
"\n"
851#ifdef ESPHOME_LOG_HAS_VERBOSE
853 ESP_LOGV(TAG,
" Priority: %d", this->
get_sta_priority(*config->get_bssid()));
856#ifdef USE_WIFI_11KV_SUPPORT
860 this->
btm_ ?
"enabled" :
"disabled", this->
rrm_ ?
"enabled" :
"disabled");
868 ESP_LOGD(TAG,
"Enabling");
878 ESP_LOGD(TAG,
"Disabling");
888 ESP_LOGD(TAG,
"Starting scan");
947template<
typename VectorType>
static void insertion_sort_scan_results(VectorType &results) {
948 const size_t size = results.size();
949 for (
size_t i = 1; i < size; i++) {
951 WiFiScanResult key = results[i];
956 while (j >= 0 && wifi_scan_result_is_better(key, results[j])) {
957 results[j + 1] = results[j];
960 results[j + 1] = key;
971 ESP_LOGI(TAG,
"- '%s' %s" LOG_SECRET(
"(%s) ")
"%s", res.
get_ssid().c_str(),
972 res.
get_is_hidden() ? LOG_STR_LITERAL(
"(HIDDEN) ") : LOG_STR_LITERAL(
""), bssid_s,
976 ESP_LOGD(TAG,
"- " LOG_SECRET(
"'%s'")
" " LOG_SECRET(
"(%s) ")
"%s", res.
get_ssid().c_str(), bssid_s,
984 ESP_LOGE(TAG,
"Scan timeout");
993 ESP_LOGW(TAG,
"No networks found");
998 ESP_LOGD(TAG,
"Found networks:");
1000 for (
auto &ap : this->
sta_) {
1001 if (res.matches(ap)) {
1002 res.set_matches(
true);
1004 const bssid_t &bssid = res.get_bssid();
1015 insertion_sort_scan_results(this->scan_result_);
1017 for (
auto &res : this->scan_result_) {
1018 log_scan_result(res);
1026 bool found_match =
false;
1028 for (
size_t i = 0; i < this->
sta_.size(); i++) {
1029 if (scan_res.
matches(this->sta_[i])) {
1040 ESP_LOGW(TAG,
"No matching network found");
1074 ESP_LOGW(TAG,
"Connection incomplete");
1079 ESP_LOGI(TAG,
"Connected");
1085 ESP_LOGW(TAG, LOG_SECRET(
"'%s'")
" should be marked hidden", config->get_ssid().c_str());
1098#ifdef USE_CAPTIVE_PORTAL
1103 ESP_LOGD(TAG,
"Disabling AP");
1118#ifdef USE_WIFI_FAST_CONNECT
1133 ESP_LOGW(TAG,
"Connection timeout");
1139 ESP_LOGW(TAG,
"Connecting to network failed (callback)");
1149 ESP_LOGW(TAG,
"Network no longer found");
1155 ESP_LOGW(TAG,
"Connecting to network failed");
1160 ESP_LOGW(TAG,
"Unknown connection status %d", (
int)
status);
1173#ifdef USE_WIFI_FAST_CONNECT
1182 if (!this->
sta_.empty() && this->sta_[0].get_hidden()) {
1190 if (this->
num_retried_ + 1 < WIFI_RETRY_COUNT_PER_SSID) {
1197 if (next_index < this->
sta_.size() && this->sta_[next_index].get_hidden()) {
1213 if (!this->
scan_result_.empty() && !this->scan_result_[0].get_matches()) {
1217 if (this->
num_retried_ + 1 < WIFI_RETRY_COUNT_PER_BSSID) {
1236 if (this->
num_retried_ + 1 < WIFI_RETRY_COUNT_PER_SSID) {
1286 if (old_phase == new_phase) {
1290 ESP_LOGD(TAG,
"Retry phase: %s → %s", LOG_STR_ARG(retry_phase_to_log_string(old_phase)),
1291 LOG_STR_ARG(retry_phase_to_log_string(new_phase)));
1297 switch (new_phase) {
1298#ifdef USE_WIFI_FAST_CONNECT
1313#ifdef USE_WIFI_FAST_CONNECT
1315 ESP_LOGI(TAG,
"Fast connect exhausted, falling back to scan");
1342 ESP_LOGD(TAG,
"All SSIDs visible or already tried, skipping hidden mode");
1382 if (first_priority != std::numeric_limits<int8_t>::min()) {
1387 if (pri.priority != first_priority) {
1393 ESP_LOGD(TAG,
"Clearing BSSID priorities (all at minimum)");
1394 this->sta_priorities_.clear();
1395 this->sta_priorities_.shrink_to_fit();
1425 failed_bssid = *config->get_bssid();
1437 ssid = config->get_ssid();
1442 uint8_t max_retries = get_max_retries_for_phase(this->
retry_phase_);
1443 bool is_last_attempt = (this->
num_retried_ + 1 >= max_retries);
1447 int8_t new_priority = old_priority;
1449 if (is_last_attempt) {
1452 (old_priority > std::numeric_limits<int8_t>::min()) ? (old_priority - 1) : std::numeric_limits<int8_t>::min();
1455 ESP_LOGD(TAG,
"Failed " LOG_SECRET(
"'%s'")
" " LOG_SECRET(
"(%s)")
", priority %d → %d", ssid.c_str(),
1477#ifdef USE_WIFI_FAST_CONNECT
1482 ESP_LOGD(TAG,
"Next AP in %s", LOG_STR_ARG(retry_phase_to_log_string(this->
retry_phase_)));
1491 if (next_index < this->
sta_.size() && this->sta_[next_index].get_hidden()) {
1494 ESP_LOGD(TAG,
"Next explicit hidden network at index %d",
static_cast<int>(next_index));
1506 if (next_index != -1) {
1526 ESP_LOGD(TAG,
"Retry attempt %u/%u in phase %s", this->
num_retried_ + 1,
1542 if (next_phase == current_phase) {
1568#ifdef USE_CAPTIVE_PORTAL
1582#ifdef USE_WIFI_FAST_CONNECT
1588 if (fast_connect_save.ap_index < 0 ||
static_cast<size_t>(fast_connect_save.ap_index) >= this->sta_.size()) {
1589 ESP_LOGW(TAG,
"AP index out of bounds");
1597 params = this->
sta_[fast_connect_save.ap_index];
1601 std::copy(fast_connect_save.bssid, fast_connect_save.bssid + 6, bssid.begin());
1607 ESP_LOGD(TAG,
"Loaded fast_connect settings");
1623 if (this->
fast_connect_pref_.
load(&previous_save) && memcmp(previous_save.bssid, bssid.data(), 6) == 0 &&
1624 previous_save.channel == channel && previous_save.ap_index == ap_index) {
1629 memcpy(fast_connect_save.bssid, bssid.data(), 6);
1630 fast_connect_save.channel = channel;
1631 fast_connect_save.ap_index = ap_index;
1635 ESP_LOGD(TAG,
"Saved fast_connect settings");
1643#ifdef USE_WIFI_WPA2_EAP
1647#ifdef USE_WIFI_MANUAL_IP
1654#ifdef USE_WIFI_WPA2_EAP
1658#ifdef USE_WIFI_MANUAL_IP
1668 ssid_(std::move(ssid)),
1669 with_auth_(with_auth),
1670 is_hidden_(is_hidden) {}
1677 }
else if (!config.
get_ssid().empty()) {
1679 if (config.
get_ssid() != this->ssid_)
1688#ifdef USE_WIFI_WPA2_EAP
std::string get_compilation_time() const
bool is_name_add_mac_suffix_enabled() const
const std::string & get_name() const
Get the name of this Application set by pre_setup().
uint32_t IRAM_ATTR HOT get_loop_component_start_time() const
Get the cached time in milliseconds from when the current component started its loop execution.
void status_set_warning(const char *message=nullptr)
void status_clear_warning()
virtual bool sync()=0
Commit pending writes to flash.
virtual ESPPreferenceObject make_preference(size_t length, uint32_t type, bool in_flash)=0
void trigger(const Ts &...x)
Inform the parent automation that the event has triggered.
value_type const & value() const
const optional< bssid_t > & get_bssid() const
const std::string & get_ssid() const
void set_ssid(const std::string &ssid)
const optional< uint8_t > & get_channel() const
const optional< EAPAuth > & get_eap() const
void set_channel(optional< uint8_t > channel)
const std::string & get_password() const
void set_bssid(bssid_t bssid)
optional< uint8_t > channel_
optional< bssid_t > bssid_
optional< ManualIP > manual_ip_
void set_eap(optional< EAPAuth > eap_auth)
void set_password(const std::string &password)
void set_manual_ip(optional< ManualIP > manual_ip)
const optional< ManualIP > & get_manual_ip() const
void set_hidden(bool hidden)
This component is responsible for managing the ESP WiFi interface.
bool is_captive_portal_active_()
bool did_scan_this_cycle_
bool error_from_callback_
void add_sta(const WiFiAP &ap)
bool load_fast_connect_settings_(WiFiAP ¶ms)
bool wifi_apply_power_save_()
void set_ap(const WiFiAP &ap)
Setup an Access Point that should be created if no connection to a station can be made.
ESPPreferenceObject pref_
void set_sta(const WiFiAP &ap)
WiFiPowerSaveMode power_save_
bool has_sta_priority(const bssid_t &bssid)
const WiFiAP * get_selected_sta_() const
int8_t get_sta_priority(const bssid_t bssid)
void log_and_adjust_priority_for_failed_connect_()
Log failed connection and decrease BSSID priority to avoid repeated attempts.
void init_sta(size_t count)
void check_connecting_finished()
void save_wifi_sta(const std::string &ssid, const std::string &password)
WiFiComponentState state_
wifi_scan_vector_t< WiFiScanResult > scan_result_
bool skip_cooldown_next_cycle_
void set_sta_priority(const bssid_t bssid, int8_t priority)
void print_connect_params_()
void loop() override
Reconnect WiFi if required.
void start_connecting(const WiFiAP &ap)
void advance_to_next_target_or_increment_retry_()
Advance to next target (AP/SSID) within current phase, or increment retry counter Called when staying...
void check_scanning_finished()
network::IPAddress get_dns_address(int num)
WiFiComponent()
Construct a WiFiComponent.
std::vector< WiFiSTAPriority > sta_priorities_
int8_t selected_sta_index_
void save_fast_connect_settings_()
bool wifi_start_ap_(const WiFiAP &ap)
int32_t get_wifi_channel()
network::IPAddress wifi_subnet_mask_()
network::IPAddress wifi_soft_ap_ip()
void set_passive_scan(bool passive)
network::IPAddress wifi_gateway_ip_()
void set_power_save_mode(WiFiPowerSaveMode power_save)
int8_t find_next_hidden_sta_(int8_t start_index)
Find next SSID that wasn't in scan results (might be hidden) Returns index of next potentially hidden...
Trigger * connect_trigger_
ESPPreferenceObject fast_connect_pref_
void clear_priorities_if_all_min_()
Clear BSSID priority tracking if all priorities are at minimum (saves memory)
WiFiRetryPhase determine_next_phase_()
Determine next retry phase based on current state and failure conditions.
network::IPAddress wifi_dns_ip_(int num)
float get_loop_priority() const override
bool wifi_apply_hostname_()
bool wifi_sta_pre_setup_()
network::IPAddresses get_ip_addresses()
Trigger * disconnect_trigger_
float get_setup_priority() const override
WIFI setup_priority.
bool is_esp32_improv_active_()
FixedVector< WiFiAP > sta_
int8_t find_first_non_hidden_index_() const
Find the index of the first non-hidden network Returns where EXPLICIT_HIDDEN phase would have stopped...
bool ssid_was_seen_in_scan_(const std::string &ssid) const
Check if an SSID was seen in the most recent scan results Used to skip hidden mode for SSIDs we know ...
bool needs_scan_results_() const
Check if we need valid scan results for the current phase but don't have any Returns true if the phas...
WiFiRetryPhase retry_phase_
bool transition_to_phase_(WiFiRetryPhase new_phase)
Transition to a new retry phase with logging Returns true if a scan was started (caller should wait),...
WiFiAP build_params_for_current_phase_()
void dump_config() override
optional< float > output_power_
const char * get_use_address() const
WiFiSTAConnectStatus wifi_sta_connect_status_()
bool wifi_sta_connect_(const WiFiAP &ap)
bool went_through_explicit_hidden_phase_() const
Check if we went through EXPLICIT_HIDDEN phase (first network is marked hidden) Used in RETRY_HIDDEN ...
bool wifi_mode_(optional< bool > sta, optional< bool > ap)
void set_reboot_timeout(uint32_t reboot_timeout)
network::IPAddresses wifi_sta_ip_addresses()
void start_initial_connection_()
Start initial connection - either scan or connect directly to hidden networks.
bool wifi_scan_start_(bool passive)
bool handled_connected_state_
void setup() override
Setup WiFi interface.
void set_use_address(const char *use_address)
const std::string & get_ssid() const
int8_t get_priority() const
uint8_t get_channel() const
bool get_with_auth() const
const bssid_t & get_bssid() const
WiFiScanResult(const bssid_t &bssid, std::string ssid, uint8_t channel, int8_t rssi, bool with_auth, bool is_hidden)
bool matches(const WiFiAP &config) const
void set_matches(bool matches)
bool get_is_hidden() const
bool operator==(const WiFiScanResult &rhs) const
struct @65::@66 __attribute__
CaptivePortal * global_captive_portal
ESP32ImprovComponent * global_improv_component
std::array< IPAddress, 5 > IPAddresses
std::array< uint8_t, 6 > bssid_t
const LogString * get_signal_bars(int8_t rssi)
@ ERROR_NETWORK_NOT_FOUND
WiFiRetryPhase
Tracks the current retry strategy/phase for WiFi connection attempts.
@ RETRY_HIDDEN
Retry networks not found in scan (might be hidden)
@ RESTARTING_ADAPTER
Restarting WiFi adapter to clear stuck state.
@ INITIAL_CONNECT
Initial connection attempt (varies based on fast_connect setting)
@ EXPLICIT_HIDDEN
Explicitly hidden networks (user marked as hidden, try before scanning)
@ FAST_CONNECT_CYCLING_APS
Fast connect mode: cycling through configured APs (config-only, no scan)
@ SCAN_CONNECTING
Scan-based: connecting to best AP from scan results.
WiFiComponent * global_wifi_component
@ WIFI_COMPONENT_STATE_DISABLED
WiFi is disabled.
@ WIFI_COMPONENT_STATE_AP
WiFi is in AP-only mode and internal AP is already enabled.
@ WIFI_COMPONENT_STATE_STA_CONNECTING
WiFi is in STA(+AP) mode and currently connecting to an AP.
@ WIFI_COMPONENT_STATE_OFF
Nothing has been initialized yet.
@ WIFI_COMPONENT_STATE_STA_SCANNING
WiFi is in STA-only mode and currently scanning for APs.
@ WIFI_COMPONENT_STATE_COOLDOWN
WiFi is in cooldown mode because something went wrong, scanning will begin after a short period of ti...
@ WIFI_COMPONENT_STATE_STA_CONNECTED
WiFi is in STA(+AP) mode and successfully connected.
Providing packet encoding functions for exchanging data with a remote host.
void format_mac_addr_upper(const uint8_t *mac, char *output)
Format MAC address as XX:XX:XX:XX:XX:XX (uppercase)
ESPPreferences * global_preferences
uint32_t fnv1_hash(const char *str)
Calculate a FNV-1 hash of str.
std::string get_mac_address_pretty()
Get the device MAC address as a string, in colon-separated uppercase hex notation.
void IRAM_ATTR HOT yield()
std::string format_mac_address_pretty(const uint8_t *mac)
uint32_t IRAM_ATTR HOT millis()
Application App
Global storage of Application pointer - only one Application can exist.
esp_eap_ttls_phase2_types ttls_phase_2
Struct for setting static IPs in WiFiComponent.