ESPHome
2023.11.6
|
This component is responsible for managing the ESP WiFi interface. More...
#include <wifi_component.h>
Public Member Functions | |
WiFiComponent () | |
Construct a WiFiComponent. More... | |
void | set_sta (const WiFiAP &ap) |
void | add_sta (const WiFiAP &ap) |
void | clear_sta () |
void | set_ap (const WiFiAP &ap) |
Setup an Access Point that should be created if no connection to a station can be made. More... | |
WiFiAP | get_ap () |
void | enable () |
void | disable () |
bool | is_disabled () |
void | start_scanning () |
void | check_scanning_finished () |
void | start_connecting (const WiFiAP &ap, bool two) |
void | set_fast_connect (bool fast_connect) |
void | set_ap_timeout (uint32_t ap_timeout) |
void | check_connecting_finished () |
void | retry_connect () |
bool | can_proceed () override |
void | set_reboot_timeout (uint32_t reboot_timeout) |
bool | is_connected () |
void | set_power_save_mode (WiFiPowerSaveMode power_save) |
void | set_output_power (float output_power) |
void | set_passive_scan (bool passive) |
void | save_wifi_sta (const std::string &ssid, const std::string &password) |
void | setup () override |
Setup WiFi interface. More... | |
void | start () |
void | dump_config () override |
float | get_setup_priority () const override |
WIFI setup_priority. More... | |
float | get_loop_priority () const override |
void | loop () override |
Reconnect WiFi if required. More... | |
bool | has_sta () const |
bool | has_ap () const |
void | set_btm (bool btm) |
void | set_rrm (bool rrm) |
network::IPAddress | get_dns_address (int num) |
network::IPAddress | get_ip_address () |
std::string | get_use_address () const |
void | set_use_address (const std::string &use_address) |
const std::vector< WiFiScanResult > & | get_scan_result () const |
network::IPAddress | wifi_soft_ap_ip () |
bool | has_sta_priority (const bssid_t &bssid) |
float | get_sta_priority (const bssid_t bssid) |
void | set_sta_priority (const bssid_t bssid, float priority) |
network::IPAddress | wifi_sta_ip () |
std::string | wifi_ssid () |
bssid_t | wifi_bssid () |
int8_t | wifi_rssi () |
void | set_enable_on_boot (bool enable_on_boot) |
Trigger * | get_connect_trigger () const |
Trigger * | get_disconnect_trigger () const |
![]() | |
float | get_actual_setup_priority () const |
void | set_setup_priority (float priority) |
void | call () |
virtual void | on_shutdown () |
virtual void | on_safe_shutdown () |
uint32_t | get_component_state () const |
virtual void | mark_failed () |
Mark this component as failed. More... | |
bool | is_failed () |
bool | is_ready () |
bool | status_has_warning () |
bool | status_has_error () |
void | status_set_warning () |
void | status_set_error () |
void | status_clear_warning () |
void | status_clear_error () |
void | status_momentary_warning (const std::string &name, uint32_t length=5000) |
void | status_momentary_error (const std::string &name, uint32_t length=5000) |
bool | has_overridden_loop () const |
void | set_component_source (const char *source) |
Set where this component was loaded from for some debug messages. More... | |
const char * | get_component_source () const |
Get the integration where this component was declared as a string. More... | |
Protected Member Functions | |
void | setup_ap_config_ () |
void | print_connect_params_ () |
void | wifi_loop_ () |
bool | wifi_mode_ (optional< bool > sta, optional< bool > ap) |
bool | wifi_sta_pre_setup_ () |
bool | wifi_apply_output_power_ (float output_power) |
bool | wifi_apply_power_save_ () |
bool | wifi_sta_ip_config_ (optional< ManualIP > manual_ip) |
bool | wifi_apply_hostname_ () |
bool | wifi_sta_connect_ (const WiFiAP &ap) |
void | wifi_pre_setup_ () |
WiFiSTAConnectStatus | wifi_sta_connect_status_ () |
bool | wifi_scan_start_ (bool passive) |
bool | wifi_ap_ip_config_ (optional< ManualIP > manual_ip) |
bool | wifi_start_ap_ (const WiFiAP &ap) |
bool | wifi_disconnect_ () |
int32_t | wifi_channel_ () |
network::IPAddress | wifi_subnet_mask_ () |
network::IPAddress | wifi_gateway_ip_ () |
network::IPAddress | wifi_dns_ip_ (int num) |
bool | is_captive_portal_active_ () |
bool | is_esp32_improv_active_ () |
void | wifi_scan_done_callback_ (void *arg, STATUS status) |
void | wifi_event_callback_ (arduino_event_id_t event, arduino_event_info_t info) |
void | wifi_scan_done_callback_ () |
void | wifi_process_event_ (IDFWiFiEvent *data) |
void | wifi_scan_result (void *env, const cyw43_ev_scan_result_t *result) |
void | wifi_event_callback_ (arduino_event_id_t event, arduino_event_info_t info) |
void | wifi_scan_done_callback_ () |
![]() | |
virtual void | call_loop () |
virtual void | call_setup () |
virtual void | call_dump_config () |
void | set_interval (const std::string &name, uint32_t interval, std::function< void()> &&f) |
Set an interval function with a unique name. More... | |
void | set_interval (uint32_t interval, std::function< void()> &&f) |
bool | cancel_interval (const std::string &name) |
Cancel an interval function. More... | |
void | set_retry (const std::string &name, uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f) |
Set an retry function with a unique name. More... | |
void | set_retry (uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f) |
bool | cancel_retry (const std::string &name) |
Cancel a retry function. More... | |
void | set_timeout (const std::string &name, uint32_t timeout, std::function< void()> &&f) |
Set a timeout function with a unique name. More... | |
void | set_timeout (uint32_t timeout, std::function< void()> &&f) |
bool | cancel_timeout (const std::string &name) |
Cancel a timeout function. More... | |
void | defer (const std::string &name, std::function< void()> &&f) |
Defer a callback to the next loop() call. More... | |
void | defer (std::function< void()> &&f) |
Defer a callback to the next loop() call. More... | |
bool | cancel_defer (const std::string &name) |
Cancel a defer callback using the specified name, name must not be empty. More... | |
Static Protected Member Functions | |
static std::string | format_mac_addr (const uint8_t mac[6]) |
static void | wifi_event_callback (System_Event_t *event) |
static void | s_wifi_scan_done_callback (void *arg, STATUS status) |
static int | s_wifi_scan_result (void *env, const cyw43_ev_scan_result_t *result) |
This component is responsible for managing the ESP WiFi interface.
Definition at line 188 of file wifi_component.h.
esphome::wifi::WiFiComponent::WiFiComponent | ( | ) |
Construct a WiFiComponent.
Definition at line 193 of file wifi_component.cpp.
void esphome::wifi::WiFiComponent::add_sta | ( | const WiFiAP & | ap | ) |
Definition at line 265 of file wifi_component.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 659 of file wifi_component.cpp.
void esphome::wifi::WiFiComponent::check_connecting_finished | ( | ) |
Definition at line 563 of file wifi_component.cpp.
void esphome::wifi::WiFiComponent::check_scanning_finished | ( | ) |
Definition at line 446 of file wifi_component.cpp.
void esphome::wifi::WiFiComponent::clear_sta | ( | ) |
Definition at line 270 of file wifi_component.cpp.
void esphome::wifi::WiFiComponent::disable | ( | ) |
Definition at line 427 of file wifi_component.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 558 of file wifi_component.cpp.
void esphome::wifi::WiFiComponent::enable | ( | ) |
Definition at line 417 of file wifi_component.cpp.
|
staticprotected |
Definition at line 674 of file wifi_component.cpp.
|
inline |
Definition at line 205 of file wifi_component.h.
|
inline |
Definition at line 297 of file wifi_component.h.
|
inline |
Definition at line 298 of file wifi_component.h.
network::IPAddress esphome::wifi::WiFiComponent::get_dns_address | ( | int | num | ) |
Definition at line 209 of file wifi_component.cpp.
network::IPAddress esphome::wifi::WiFiComponent::get_ip_address | ( | ) |
Definition at line 202 of file wifi_component.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 258 of file wifi_component.cpp.
|
inline |
Definition at line 258 of file wifi_component.h.
|
overridevirtual |
WIFI setup_priority.
Reimplemented from esphome::Component.
Definition at line 35 of file wifi_component.cpp.
|
inline |
Definition at line 269 of file wifi_component.h.
std::string esphome::wifi::WiFiComponent::get_use_address | ( | ) | const |
Definition at line 214 of file wifi_component.cpp.
bool esphome::wifi::WiFiComponent::has_ap | ( | ) | const |
Definition at line 195 of file wifi_component.cpp.
bool esphome::wifi::WiFiComponent::has_sta | ( | ) | const |
Definition at line 196 of file wifi_component.cpp.
|
inline |
Definition at line 262 of file wifi_component.h.
|
protected |
Definition at line 679 of file wifi_component.cpp.
bool esphome::wifi::WiFiComponent::is_connected | ( | ) |
Definition at line 666 of file wifi_component.cpp.
bool esphome::wifi::WiFiComponent::is_disabled | ( | ) |
Definition at line 437 of file wifi_component.cpp.
|
protected |
Definition at line 686 of file wifi_component.cpp.
|
overridevirtual |
Reconnect WiFi if required.
Reimplemented from esphome::Component.
Definition at line 107 of file wifi_component.cpp.
|
protected |
Definition at line 388 of file wifi_component.cpp.
void esphome::wifi::WiFiComponent::retry_connect | ( | ) |
Definition at line 629 of file wifi_component.cpp.
|
staticprotected |
Definition at line 670 of file wifi_component_esp8266.cpp.
|
staticprotected |
Definition at line 113 of file wifi_component_pico_w.cpp.
void esphome::wifi::WiFiComponent::save_wifi_sta | ( | const std::string & | ssid, |
const std::string & | password | ||
) |
Definition at line 271 of file wifi_component.cpp.
void esphome::wifi::WiFiComponent::set_ap | ( | const WiFiAP & | ap | ) |
Setup an Access Point that should be created if no connection to a station can be made.
This can also be used without set_sta(). Then the AP will always be active.
If both STA and AP are defined, then both will be enabled at startup, but if a connection to a station can be made, the AP will be turned off again.
Definition at line 261 of file wifi_component.cpp.
|
inline |
Definition at line 214 of file wifi_component.h.
void esphome::wifi::WiFiComponent::set_btm | ( | bool | btm | ) |
Definition at line 199 of file wifi_component.cpp.
|
inline |
Definition at line 295 of file wifi_component.h.
void esphome::wifi::WiFiComponent::set_fast_connect | ( | bool | fast_connect | ) |
Definition at line 197 of file wifi_component.cpp.
|
inline |
Definition at line 227 of file wifi_component.h.
void esphome::wifi::WiFiComponent::set_passive_scan | ( | bool | passive | ) |
Definition at line 672 of file wifi_component.cpp.
void esphome::wifi::WiFiComponent::set_power_save_mode | ( | WiFiPowerSaveMode | power_save | ) |
Definition at line 670 of file wifi_component.cpp.
void esphome::wifi::WiFiComponent::set_reboot_timeout | ( | uint32_t | reboot_timeout | ) |
Definition at line 665 of file wifi_component.cpp.
void esphome::wifi::WiFiComponent::set_rrm | ( | bool | rrm | ) |
Definition at line 200 of file wifi_component.cpp.
void esphome::wifi::WiFiComponent::set_sta | ( | const WiFiAP & | ap | ) |
Definition at line 266 of file wifi_component.cpp.
|
inline |
Definition at line 276 of file wifi_component.h.
void esphome::wifi::WiFiComponent::set_use_address | ( | const std::string & | use_address | ) |
Definition at line 220 of file wifi_component.cpp.
|
overridevirtual |
Setup WiFi interface.
Reimplemented from esphome::Component.
Definition at line 37 of file wifi_component.cpp.
|
protected |
Definition at line 221 of file wifi_component.cpp.
void esphome::wifi::WiFiComponent::start | ( | ) |
Definition at line 50 of file wifi_component.cpp.
void esphome::wifi::WiFiComponent::start_connecting | ( | const WiFiAP & | ap, |
bool | two | ||
) |
Definition at line 285 of file wifi_component.cpp.
void esphome::wifi::WiFiComponent::start_scanning | ( | ) |
Definition at line 439 of file wifi_component.cpp.
Definition at line 600 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 155 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 62 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 74 of file wifi_component_esp32_arduino.cpp.
bssid_t esphome::wifi::WiFiComponent::wifi_bssid | ( | ) |
Definition at line 702 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 713 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 700 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 716 of file wifi_component_esp32_arduino.cpp.
|
staticprotected |
Definition at line 475 of file wifi_component_esp8266.cpp.
|
protected |
Definition at line 414 of file wifi_component_esp32_arduino.cpp.
|
protected |
|
protected |
Definition at line 715 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 717 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 29 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 544 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 593 of file wifi_component_esp_idf.cpp.
int8_t esphome::wifi::WiFiComponent::wifi_rssi | ( | ) |
Definition at line 712 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 674 of file wifi_component_esp8266.cpp.
|
protected |
Definition at line 578 of file wifi_component_esp32_arduino.cpp.
|
protected |
|
protected |
Definition at line 118 of file wifi_component_pico_w.cpp.
|
protected |
Definition at line 564 of file wifi_component_esp32_arduino.cpp.
network::IPAddress esphome::wifi::WiFiComponent::wifi_soft_ap_ip | ( | ) |
Definition at line 695 of file wifi_component_esp32_arduino.cpp.
std::string esphome::wifi::WiFiComponent::wifi_ssid | ( | ) |
Definition at line 711 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 159 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 551 of file wifi_component_esp32_arduino.cpp.
network::IPAddress esphome::wifi::WiFiComponent::wifi_sta_ip | ( | ) |
Definition at line 147 of file wifi_component_esp32_arduino.cpp.
Definition at line 90 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 66 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 657 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 714 of file wifi_component_esp32_arduino.cpp.
|
protected |
Definition at line 361 of file wifi_component.h.
|
protected |
Definition at line 358 of file wifi_component.h.
|
protected |
Definition at line 370 of file wifi_component.h.
|
protected |
Definition at line 365 of file wifi_component.h.
|
protected |
Definition at line 376 of file wifi_component.h.
Definition at line 381 of file wifi_component.h.
Definition at line 382 of file wifi_component.h.
|
protected |
Definition at line 379 of file wifi_component.h.
|
protected |
Definition at line 367 of file wifi_component.h.
|
protected |
Definition at line 355 of file wifi_component.h.
|
protected |
Definition at line 360 of file wifi_component.h.
|
protected |
Definition at line 357 of file wifi_component.h.
|
protected |
Definition at line 374 of file wifi_component.h.
|
protected |
Definition at line 363 of file wifi_component.h.
|
protected |
Definition at line 362 of file wifi_component.h.
|
protected |
Definition at line 371 of file wifi_component.h.
|
protected |
Definition at line 372 of file wifi_component.h.
|
protected |
Definition at line 366 of file wifi_component.h.
|
protected |
Definition at line 373 of file wifi_component.h.
|
protected |
Definition at line 364 of file wifi_component.h.
|
protected |
Definition at line 377 of file wifi_component.h.
|
protected |
Definition at line 369 of file wifi_component.h.
|
protected |
Definition at line 368 of file wifi_component.h.
|
protected |
Definition at line 354 of file wifi_component.h.
|
protected |
Definition at line 352 of file wifi_component.h.
|
protected |
Definition at line 353 of file wifi_component.h.
|
protected |
Definition at line 359 of file wifi_component.h.
|
protected |
Definition at line 351 of file wifi_component.h.