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 = 1000;
204static constexpr uint8_t get_max_retries_for_phase(
WiFiRetryPhase phase) {
207#ifdef USE_WIFI_FAST_CONNECT
211 return WIFI_RETRY_COUNT_PER_AP;
214 return WIFI_RETRY_COUNT_PER_SSID;
217 return WIFI_RETRY_COUNT_PER_BSSID;
220 return WIFI_RETRY_COUNT_PER_SSID;
222 return WIFI_RETRY_COUNT_PER_BSSID;
226static void apply_scan_result_to_params(WiFiAP ¶ms,
const WiFiScanResult &scan) {
227 params.set_hidden(
false);
228 params.set_ssid(scan.get_ssid());
229 params.set_bssid(scan.get_bssid());
230 params.set_channel(scan.get_channel());
245 for (
const auto &conf : this->
sta_) {
246 if (conf.get_ssid() == ssid && conf.get_hidden()) {
253 if (scan.get_ssid() == ssid) {
264 for (
size_t i = start_index + 1; i < this->
sta_.size(); i++) {
265 const auto &sta = this->
sta_[i];
270 if (!include_explicit_hidden && sta.get_hidden()) {
272 if (first_non_hidden_idx < 0 ||
static_cast<int8_t
>(i) < first_non_hidden_idx) {
273 ESP_LOGD(TAG,
"Skipping " LOG_SECRET(
"'%s'")
" (explicit hidden, already tried)", sta.get_ssid().c_str());
279 ESP_LOGD(TAG,
"Hidden candidate " LOG_SECRET(
"'%s'")
" at index %d", sta.get_ssid().c_str(),
static_cast<int>(i));
280 return static_cast<int8_t
>(i);
282 ESP_LOGD(TAG,
"Skipping hidden retry for visible network " LOG_SECRET(
"'%s'"), sta.get_ssid().c_str());
291 if (!this->
sta_.empty() && this->sta_[0].get_hidden()) {
292 ESP_LOGI(TAG,
"Starting with explicit hidden network (highest priority)");
298 ESP_LOGI(TAG,
"Starting scan");
303#if defined(USE_ESP32) && defined(USE_WIFI_WPA2_EAP) && ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
304static const char *eap_phase2_to_str(esp_eap_ttls_phase2_types
type) {
306 case ESP_EAP_TTLS_PHASE2_PAP:
308 case ESP_EAP_TTLS_PHASE2_CHAP:
310 case ESP_EAP_TTLS_PHASE2_MSCHAP:
312 case ESP_EAP_TTLS_PHASE2_MSCHAPV2:
314 case ESP_EAP_TTLS_PHASE2_EAP:
346#ifdef USE_WIFI_FAST_CONNECT
352 ESP_LOGD(TAG,
"Loaded settings: %s", save.ssid);
356 sta.set_password(save.password);
363 ESP_LOGV(TAG,
"Setting Output Power Option failed");
367 ESP_LOGV(TAG,
"Setting Power Save Option failed");
371#ifdef USE_WIFI_FAST_CONNECT
376 if (loaded_fast_connect) {
377 ESP_LOGI(TAG,
"Starting fast_connect (saved) " LOG_SECRET(
"'%s'"), params.
get_ssid().c_str());
379 }
else if (!this->
sta_.empty() && !this->sta_[0].get_hidden()) {
381 ESP_LOGI(TAG,
"Starting fast_connect (config) " LOG_SECRET(
"'%s'"), this->
sta_[0].get_ssid().c_str());
394 }
else if (this->
has_ap()) {
397 ESP_LOGV(TAG,
"Setting Output Power Option failed");
399#ifdef USE_CAPTIVE_PORTAL
418 ESP_LOGW(TAG,
"Restarting adapter");
466 ESP_LOGW(TAG,
"Connection lost; reconnecting");
487 ESP_LOGI(TAG,
"Starting fallback AP");
489#ifdef USE_CAPTIVE_PORTAL
509 ESP_LOGE(TAG,
"Can't connect; rebooting");
520#ifdef USE_WIFI_11KV_SUPPORT
554 if (name.length() > 32) {
557 name.erase(25, name.length() - 32);
570 " AP Password: '%s'\n"
572 this->
ap_.
get_ssid().c_str(), this->ap_.get_password().c_str(), ip_address.c_str());
574#ifdef USE_WIFI_MANUAL_IP
576 if (manual_ip.has_value()) {
578 " AP Static IP: '%s'\n"
579 " AP Gateway: '%s'\n"
581 manual_ip->static_ip.str().c_str(), manual_ip->gateway.str().c_str(),
582 manual_ip->subnet.str().c_str());
612 if (config ==
nullptr) {
613 ESP_LOGE(TAG,
"No valid network config (selected_sta_index_=%d, sta_.size()=%zu)",
623#ifdef USE_WIFI_FAST_CONNECT
641 apply_scan_result_to_params(params, this->
scan_result_[0]);
655 return config ? *config :
WiFiAP{};
659 strncpy(save.ssid, ssid.c_str(),
sizeof(save.ssid) - 1);
660 strncpy(save.password, password.c_str(),
sizeof(save.password) - 1);
667 sta.set_password(password);
682 "Connecting to " LOG_SECRET(
"'%s'")
" " LOG_SECRET(
"(%s)")
" (priority %d, attempt %u/%u in phase %s)...",
685 LOG_STR_ARG(retry_phase_to_log_string(this->
retry_phase_)));
687#ifdef ESPHOME_LOG_HAS_VERBOSE
688 ESP_LOGV(TAG,
"Connection Params:");
689 ESP_LOGV(TAG,
" SSID: '%s'", ap.
get_ssid().c_str());
691 ESP_LOGV(TAG,
" BSSID: %s", bssid_s);
693 ESP_LOGV(TAG,
" BSSID: Not Set");
696#ifdef USE_WIFI_WPA2_EAP
697 if (ap.
get_eap().has_value()) {
698 ESP_LOGV(TAG,
" WPA2 Enterprise authentication configured:");
700 ESP_LOGV(TAG,
" Identity: " LOG_SECRET(
"'%s'"), eap_config.
identity.c_str());
701 ESP_LOGV(TAG,
" Username: " LOG_SECRET(
"'%s'"), eap_config.
username.c_str());
702 ESP_LOGV(TAG,
" Password: " LOG_SECRET(
"'%s'"), eap_config.
password.c_str());
703#if defined(USE_ESP32) && defined(USE_WIFI_WPA2_EAP) && ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
704 ESP_LOGV(TAG,
" TTLS Phase 2: " LOG_SECRET(
"'%s'"), eap_phase2_to_str(eap_config.
ttls_phase_2));
706 bool ca_cert_present = eap_config.
ca_cert !=
nullptr && strlen(eap_config.
ca_cert);
709 ESP_LOGV(TAG,
" CA Cert: %s", ca_cert_present ?
"present" :
"not present");
710 ESP_LOGV(TAG,
" Client Cert: %s", client_cert_present ?
"present" :
"not present");
711 ESP_LOGV(TAG,
" Client Key: %s", client_key_present ?
"present" :
"not present");
714 ESP_LOGV(TAG,
" Password: " LOG_SECRET(
"'%s'"), ap.
get_password().c_str());
715#ifdef USE_WIFI_WPA2_EAP
721 ESP_LOGV(TAG,
" Channel not set");
723#ifdef USE_WIFI_MANUAL_IP
726 ESP_LOGV(TAG,
" Manual IP: Static IP=%s Gateway=%s Subnet=%s DNS1=%s DNS2=%s",
m.static_ip.str().c_str(),
727 m.gateway.str().c_str(),
m.subnet.str().c_str(),
m.dns1.str().c_str(),
m.dns2.str().c_str());
731 ESP_LOGV(TAG,
" Using DHCP IP");
733 ESP_LOGV(TAG,
" Hidden: %s", YESNO(ap.
get_hidden()));
737 ESP_LOGE(TAG,
"wifi_sta_connect_ failed");
749 if (rssi == WIFI_RSSI_DISCONNECTED) {
752 return LOG_STR(
"\033[0;31m"
753 "\xc3\x97\xc3\x97\xc3\x97\xc3\x97"
765 return LOG_STR(
"\033[0;32m"
771 }
else if (rssi >= -65) {
772 return LOG_STR(
"\033[0;33m"
779 }
else if (rssi >= -85) {
780 return LOG_STR(
"\033[0;33m"
788 return LOG_STR(
"\033[0;31m"
805 ESP_LOGCONFIG(TAG,
" Disabled");
810 ESP_LOGCONFIG(TAG,
" IP Address: %s", ip.str().c_str());
815 " SSID: " LOG_SECRET(
"'%s'")
"\n"
816 " BSSID: " LOG_SECRET(
"%s")
"\n"
818 " Signal strength: %d dB %s\n"
819 " Channel: %" PRId32
"\n"
827#ifdef ESPHOME_LOG_HAS_VERBOSE
829 ESP_LOGV(TAG,
" Priority: %d", this->
get_sta_priority(*config->get_bssid()));
832#ifdef USE_WIFI_11KV_SUPPORT
836 this->
btm_ ?
"enabled" :
"disabled", this->
rrm_ ?
"enabled" :
"disabled");
844 ESP_LOGD(TAG,
"Enabling");
854 ESP_LOGD(TAG,
"Disabling");
864 ESP_LOGD(TAG,
"Starting scan");
923template<
typename VectorType>
static void insertion_sort_scan_results(VectorType &results) {
924 const size_t size = results.size();
925 for (
size_t i = 1; i < size; i++) {
927 WiFiScanResult key = results[i];
932 while (j >= 0 && wifi_scan_result_is_better(key, results[j])) {
933 results[j + 1] = results[j];
936 results[j + 1] = key;
947 ESP_LOGI(TAG,
"- '%s' %s" LOG_SECRET(
"(%s) ")
"%s", res.
get_ssid().c_str(),
948 res.
get_is_hidden() ? LOG_STR_LITERAL(
"(HIDDEN) ") : LOG_STR_LITERAL(
""), bssid_s,
952 ESP_LOGD(TAG,
"- " LOG_SECRET(
"'%s'")
" " LOG_SECRET(
"(%s) ")
"%s", res.
get_ssid().c_str(), bssid_s,
960 ESP_LOGE(TAG,
"Scan timeout");
968 ESP_LOGW(TAG,
"No networks found");
973 ESP_LOGD(TAG,
"Found networks:");
975 for (
auto &ap : this->
sta_) {
976 if (res.matches(ap)) {
977 res.set_matches(
true);
979 const bssid_t &bssid = res.get_bssid();
990 insertion_sort_scan_results(this->scan_result_);
992 for (
auto &res : this->scan_result_) {
993 log_scan_result(res);
1001 bool found_match =
false;
1003 for (
size_t i = 0; i < this->
sta_.size(); i++) {
1004 if (scan_res.
matches(this->sta_[i])) {
1015 ESP_LOGW(TAG,
"No matching network found");
1049 ESP_LOGW(TAG,
"Connection incomplete");
1054 ESP_LOGI(TAG,
"Connected");
1060 ESP_LOGW(TAG, LOG_SECRET(
"'%s'")
" should be marked hidden", config->get_ssid().c_str());
1073#ifdef USE_CAPTIVE_PORTAL
1078 ESP_LOGD(TAG,
"Disabling AP");
1093#ifdef USE_WIFI_FAST_CONNECT
1108 ESP_LOGW(TAG,
"Connection timeout");
1114 ESP_LOGW(TAG,
"Connecting to network failed (callback)");
1124 ESP_LOGW(TAG,
"Network no longer found");
1130 ESP_LOGW(TAG,
"Connecting to network failed");
1135 ESP_LOGW(TAG,
"Unknown connection status %d", (
int)
status);
1148#ifdef USE_WIFI_FAST_CONNECT
1157 if (!this->
sta_.empty() && this->sta_[0].get_hidden()) {
1165 if (this->
num_retried_ + 1 < WIFI_RETRY_COUNT_PER_SSID) {
1172 if (next_index < this->
sta_.size() && this->sta_[next_index].get_hidden()) {
1188 if (!this->
scan_result_.empty() && !this->scan_result_[0].get_matches()) {
1192 if (this->
num_retried_ + 1 < WIFI_RETRY_COUNT_PER_BSSID) {
1211 if (this->
num_retried_ + 1 < WIFI_RETRY_COUNT_PER_SSID) {
1254 if (old_phase == new_phase) {
1258 ESP_LOGD(TAG,
"Retry phase: %s → %s", LOG_STR_ARG(retry_phase_to_log_string(old_phase)),
1259 LOG_STR_ARG(retry_phase_to_log_string(new_phase)));
1265 switch (new_phase) {
1266#ifdef USE_WIFI_FAST_CONNECT
1281#ifdef USE_WIFI_FAST_CONNECT
1283 ESP_LOGI(TAG,
"Fast connect exhausted, falling back to scan");
1310 ESP_LOGD(TAG,
"All SSIDs visible or already tried, skipping hidden mode");
1344 if (first_priority != std::numeric_limits<int8_t>::min()) {
1349 if (pri.priority != first_priority) {
1355 ESP_LOGD(TAG,
"Clearing BSSID priorities (all at minimum)");
1356 this->sta_priorities_.clear();
1357 this->sta_priorities_.shrink_to_fit();
1387 failed_bssid = *config->get_bssid();
1399 ssid = config->get_ssid();
1404 uint8_t max_retries = get_max_retries_for_phase(this->
retry_phase_);
1405 bool is_last_attempt = (this->
num_retried_ + 1 >= max_retries);
1409 int8_t new_priority = old_priority;
1411 if (is_last_attempt) {
1414 (old_priority > std::numeric_limits<int8_t>::min()) ? (old_priority - 1) : std::numeric_limits<int8_t>::min();
1419 ESP_LOGD(TAG,
"Failed " LOG_SECRET(
"'%s'")
" " LOG_SECRET(
"(%s)")
", priority %d → %d", ssid.c_str(), bssid_s,
1420 old_priority, new_priority);
1441#ifdef USE_WIFI_FAST_CONNECT
1446 ESP_LOGD(TAG,
"Next AP in %s", LOG_STR_ARG(retry_phase_to_log_string(this->
retry_phase_)));
1455 if (next_index < this->
sta_.size() && this->sta_[next_index].get_hidden()) {
1458 ESP_LOGD(TAG,
"Next explicit hidden network at index %d",
static_cast<int>(next_index));
1470 if (next_index != -1) {
1490 ESP_LOGD(TAG,
"Retry attempt %u/%u in phase %s", this->
num_retried_ + 1,
1506 if (next_phase == current_phase) {
1532#ifdef USE_CAPTIVE_PORTAL
1546#ifdef USE_WIFI_FAST_CONNECT
1552 if (fast_connect_save.ap_index < 0 ||
static_cast<size_t>(fast_connect_save.ap_index) >= this->sta_.size()) {
1553 ESP_LOGW(TAG,
"AP index out of bounds");
1561 params = this->
sta_[fast_connect_save.ap_index];
1565 std::copy(fast_connect_save.bssid, fast_connect_save.bssid + 6, bssid.begin());
1571 ESP_LOGD(TAG,
"Loaded fast_connect settings");
1587 if (this->
fast_connect_pref_.
load(&previous_save) && memcmp(previous_save.bssid, bssid.data(), 6) == 0 &&
1588 previous_save.channel == channel && previous_save.ap_index == ap_index) {
1593 memcpy(fast_connect_save.bssid, bssid.data(), 6);
1594 fast_connect_save.channel = channel;
1595 fast_connect_save.ap_index = ap_index;
1599 ESP_LOGD(TAG,
"Saved fast_connect settings");
1607#ifdef USE_WIFI_WPA2_EAP
1611#ifdef USE_WIFI_MANUAL_IP
1618#ifdef USE_WIFI_WPA2_EAP
1622#ifdef USE_WIFI_MANUAL_IP
1632 ssid_(std::move(ssid)),
1633 with_auth_(with_auth),
1634 is_hidden_(is_hidden) {}
1641 }
else if (!config.
get_ssid().empty()) {
1643 if (config.
get_ssid() != this->ssid_)
1652#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 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_
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()
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.