ESPHome 2026.1.3
Loading...
Searching...
No Matches
esphome::wifi Namespace Reference

Data Structures

struct  EAPAuth
 
struct  ManualIP
 Struct for setting static IPs in WiFiComponent. More...
 
struct  SavedWifiFastConnectSettings
 
struct  SavedWifiSettings
 
class  WiFiAP
 
class  WiFiAPActiveCondition
 
class  WiFiComponent
 This component is responsible for managing the ESP WiFi interface. More...
 
class  WiFiConfigureAction
 
class  WiFiConnectedCondition
 
class  WiFiConnectStateListener
 Listener interface for WiFi connection state changes. More...
 
class  WiFiDisableAction
 
class  WiFiEnableAction
 
class  WiFiEnabledCondition
 
class  WiFiIPStateListener
 Listener interface for WiFi IP state changes. More...
 
class  WiFiPowerSaveListener
 Listener interface for WiFi power save mode changes. More...
 
class  WiFiScanResult
 
class  WiFiScanResultsListener
 Listener interface for WiFi scan results. More...
 
struct  WiFiSTAPriority
 

Typedefs

using bssid_t = std::array<uint8_t, 6>
 
template<typename T >
using wifi_scan_vector_t = std::vector<T>
 
using esphome_wifi_event_id_t = arduino_event_id_t
 
using esphome_wifi_event_info_t = arduino_event_info_t
 

Enumerations

enum  WiFiComponentState : uint8_t {
  WIFI_COMPONENT_STATE_OFF = 0 , WIFI_COMPONENT_STATE_DISABLED , WIFI_COMPONENT_STATE_COOLDOWN , WIFI_COMPONENT_STATE_STA_SCANNING ,
  WIFI_COMPONENT_STATE_STA_CONNECTING , WIFI_COMPONENT_STATE_STA_CONNECTED , WIFI_COMPONENT_STATE_AP
}
 
enum class  WiFiSTAConnectStatus : int {
  IDLE , CONNECTING , CONNECTED , ERROR_NETWORK_NOT_FOUND ,
  ERROR_CONNECT_FAILED
}
 
enum class  WiFiRetryPhase : uint8_t {
  INITIAL_CONNECT , FAST_CONNECT_CYCLING_APS , EXPLICIT_HIDDEN , SCAN_CONNECTING ,
  RETRY_HIDDEN , RESTARTING_ADAPTER
}
 Tracks the current retry strategy/phase for WiFi connection attempts. More...
 
enum class  RoamingState : uint8_t { IDLE , SCANNING , CONNECTING , RECONNECTING }
 Tracks post-connect roaming state machine. More...
 
enum class  RetryHiddenMode : uint8_t { SCAN_BASED , BLIND_RETRY }
 Controls how RETRY_HIDDEN phase selects networks to try. More...
 
enum  WiFiPowerSaveMode : uint8_t { WIFI_POWER_SAVE_NONE = 0 , WIFI_POWER_SAVE_LIGHT , WIFI_POWER_SAVE_HIGH }
 
enum  WifiMinAuthMode : uint8_t { WIFI_MIN_AUTH_MODE_WPA = 0 , WIFI_MIN_AUTH_MODE_WPA2 , WIFI_MIN_AUTH_MODE_WPA3 }
 
enum class  LTWiFiSTAState : uint8_t {
  IDLE , CONNECTING , CONNECTED , ERROR_NOT_FOUND ,
  ERROR_FAILED
}
 

Functions

const LogString * get_signal_bars (int8_t rssi)
 
 __attribute__ ((noinline)) static void log_scan_result(const WiFiScanResult &res)
 
struct netif * eagle_lwip_getif (int netif_index)
 
void netif_set_addr (struct netif *netif, const ip4_addr_t *ip, const ip4_addr_t *netmask, const ip4_addr_t *gw)
 
const LogString * get_auth_mode_str (uint8_t mode)
 
const LogString * get_op_mode_str (uint8_t mode)
 
const LogString * get_disconnect_reason_str (uint8_t reason)
 

Variables

WiFiComponentglobal_wifi_component
 
struct esphome::wifi::SavedWifiSettings PACKED
 

Typedef Documentation

◆ bssid_t

using esphome::wifi::bssid_t = std::array<uint8_t, 6>

Definition at line 162 of file wifi_component.h.

◆ esphome_wifi_event_id_t

using esphome::wifi::esphome_wifi_event_id_t = arduino_event_id_t

Definition at line 338 of file wifi_component_libretiny.cpp.

◆ esphome_wifi_event_info_t

using esphome::wifi::esphome_wifi_event_info_t = arduino_event_info_t

Definition at line 339 of file wifi_component_libretiny.cpp.

◆ wifi_scan_vector_t

template<typename T >
using esphome::wifi::wifi_scan_vector_t = std::vector<T>

Definition at line 167 of file wifi_component.h.

Enumeration Type Documentation

◆ LTWiFiSTAState

enum class esphome::wifi::LTWiFiSTAState : uint8_t
strong
Enumerator
IDLE 
CONNECTING 
CONNECTED 
ERROR_NOT_FOUND 
ERROR_FAILED 

Definition at line 79 of file wifi_component_libretiny.cpp.

◆ RetryHiddenMode

enum class esphome::wifi::RetryHiddenMode : uint8_t
strong

Controls how RETRY_HIDDEN phase selects networks to try.

Enumerator
SCAN_BASED 

Normal mode: scan completed, only try networks NOT visible in scan results (truly hidden networks that need probe requests)

BLIND_RETRY 

Blind retry mode: scanning disabled (captive portal/improv active), try ALL configured networks sequentially without consulting scan results.

Definition at line 128 of file wifi_component.h.

◆ RoamingState

enum class esphome::wifi::RoamingState : uint8_t
strong

Tracks post-connect roaming state machine.

Enumerator
IDLE 

Not roaming, waiting for next check interval.

SCANNING 

Scanning for better AP.

CONNECTING 

Attempting to connect to better AP found in scan.

RECONNECTING 

Roam connection failed, reconnecting to any available AP.

Definition at line 116 of file wifi_component.h.

◆ WiFiComponentState

Enumerator
WIFI_COMPONENT_STATE_OFF 

Nothing has been initialized yet.

Internal AP, if configured, is disabled at this point.

WIFI_COMPONENT_STATE_DISABLED 

WiFi is disabled.

WIFI_COMPONENT_STATE_COOLDOWN 

WiFi is in cooldown mode because something went wrong, scanning will begin after a short period of time.

WIFI_COMPONENT_STATE_STA_SCANNING 

WiFi is in STA-only mode and currently scanning for APs.

WIFI_COMPONENT_STATE_STA_CONNECTING 

WiFi is in STA(+AP) mode and currently connecting to an AP.

WIFI_COMPONENT_STATE_STA_CONNECTED 

WiFi is in STA(+AP) mode and successfully connected.

WIFI_COMPONENT_STATE_AP 

WiFi is in AP-only mode and internal AP is already enabled.

Definition at line 72 of file wifi_component.h.

◆ WifiMinAuthMode

Enumerator
WIFI_MIN_AUTH_MODE_WPA 
WIFI_MIN_AUTH_MODE_WPA2 
WIFI_MIN_AUTH_MODE_WPA3 

Definition at line 260 of file wifi_component.h.

◆ WiFiPowerSaveMode

Enumerator
WIFI_POWER_SAVE_NONE 
WIFI_POWER_SAVE_LIGHT 
WIFI_POWER_SAVE_HIGH 

Definition at line 254 of file wifi_component.h.

◆ WiFiRetryPhase

enum class esphome::wifi::WiFiRetryPhase : uint8_t
strong

Tracks the current retry strategy/phase for WiFi connection attempts.

Enumerator
INITIAL_CONNECT 

Initial connection attempt (varies based on fast_connect setting)

FAST_CONNECT_CYCLING_APS 

Fast connect mode: cycling through configured APs (config-only, no scan)

EXPLICIT_HIDDEN 

Explicitly hidden networks (user marked as hidden, try before scanning)

SCAN_CONNECTING 

Scan-based: connecting to best AP from scan results.

RETRY_HIDDEN 

Retry networks not found in scan (might be hidden)

RESTARTING_ADAPTER 

Restarting WiFi adapter to clear stuck state.

Definition at line 98 of file wifi_component.h.

◆ WiFiSTAConnectStatus

enum class esphome::wifi::WiFiSTAConnectStatus : int
strong
Enumerator
IDLE 
CONNECTING 
CONNECTED 
ERROR_NETWORK_NOT_FOUND 
ERROR_CONNECT_FAILED 

Definition at line 89 of file wifi_component.h.

Function Documentation

◆ __attribute__()

esphome::wifi::__attribute__ ( (noinline) ) const &

Definition at line 1181 of file wifi_component.cpp.

◆ eagle_lwip_getif()

struct netif * esphome::wifi::eagle_lwip_getif ( int netif_index)

◆ get_auth_mode_str()

const char * esphome::wifi::get_auth_mode_str ( uint8_t mode)

Definition at line 401 of file wifi_component_esp8266.cpp.

◆ get_disconnect_reason_str()

const char * esphome::wifi::get_disconnect_reason_str ( uint8_t reason)

Definition at line 432 of file wifi_component_esp8266.cpp.

◆ get_op_mode_str()

const char * esphome::wifi::get_op_mode_str ( uint8_t mode)

Definition at line 417 of file wifi_component_esp8266.cpp.

◆ get_signal_bars()

const LogString * esphome::wifi::get_signal_bars ( int8_t rssi)

Definition at line 986 of file wifi_component.cpp.

◆ netif_set_addr()

void esphome::wifi::netif_set_addr ( struct netif * netif,
const ip4_addr_t * ip,
const ip4_addr_t * netmask,
const ip4_addr_t * gw )

Variable Documentation

◆ global_wifi_component

WiFiComponent * esphome::wifi::global_wifi_component

Definition at line 2178 of file wifi_component.cpp.

◆ PACKED

struct esphome::wifi::SavedWifiFastConnectSettings esphome::wifi::PACKED