4 #ifdef USE_ESP32_FRAMEWORK_ARDUINO 11 #ifdef USE_WIFI_WPA2_EAP 14 #include "lwip/apps/sntp.h" 27 static const char *
const TAG =
"wifi_esp32";
29 static esp_netif_t *s_sta_netif =
nullptr;
31 static esp_netif_t *s_ap_netif =
nullptr;
34 static bool s_sta_connecting =
false;
39 WiFi.persistent(
false);
45 wifi_mode_t current_mode = WiFiClass::getMode();
46 bool current_sta = current_mode == WIFI_MODE_STA || current_mode == WIFI_MODE_APSTA;
47 bool current_ap = current_mode == WIFI_MODE_AP || current_mode == WIFI_MODE_APSTA;
53 if (set_sta && set_ap) {
54 set_mode = WIFI_MODE_APSTA;
55 }
else if (set_sta && !set_ap) {
56 set_mode = WIFI_MODE_STA;
57 }
else if (!set_sta && set_ap) {
58 set_mode = WIFI_MODE_AP;
60 set_mode = WIFI_MODE_NULL;
63 if (current_mode == set_mode)
66 if (set_sta && !current_sta) {
67 ESP_LOGV(TAG,
"Enabling STA.");
68 }
else if (!set_sta && current_sta) {
69 ESP_LOGV(TAG,
"Disabling STA.");
71 if (set_ap && !current_ap) {
72 ESP_LOGV(TAG,
"Enabling AP.");
73 }
else if (!set_ap && current_ap) {
74 ESP_LOGV(TAG,
"Disabling AP.");
80 ESP_LOGW(TAG,
"Setting WiFi mode failed!");
90 s_ap_netif = esp_netif_get_handle_from_ifkey(
"WIFI_AP_DEF");
100 WiFi.setAutoReconnect(
false);
106 int8_t
val =
static_cast<int8_t
>(output_power * 4);
107 return esp_wifi_set_max_tx_power(val) == ESP_OK;
111 wifi_ps_type_t power_save;
114 power_save = WIFI_PS_MIN_MODEM;
117 power_save = WIFI_PS_MAX_MODEM;
121 power_save = WIFI_PS_NONE;
124 return esp_wifi_set_ps(power_save) == ESP_OK;
134 memset(&conf, 0,
sizeof(conf));
135 strncpy(reinterpret_cast<char *>(conf.sta.ssid), ap.
get_ssid().c_str(),
sizeof(conf.sta.ssid));
136 strncpy(reinterpret_cast<char *>(conf.sta.password), ap.
get_password().c_str(),
sizeof(conf.sta.password));
140 conf.sta.threshold.authmode = WIFI_AUTH_OPEN;
142 conf.sta.threshold.authmode = WIFI_AUTH_WPA_WPA2_PSK;
145 #ifdef USE_WIFI_WPA2_EAP 146 if (ap.
get_eap().has_value()) {
147 conf.sta.threshold.authmode = WIFI_AUTH_WPA2_ENTERPRISE;
152 conf.sta.bssid_set =
true;
153 memcpy(conf.sta.bssid, ap.
get_bssid()->data(), 6);
155 conf.sta.bssid_set =
false;
159 conf.sta.scan_method = WIFI_FAST_SCAN;
161 conf.sta.scan_method = WIFI_ALL_CHANNEL_SCAN;
165 conf.sta.listen_interval = 0;
169 conf.sta.pmf_cfg.capable =
true;
170 conf.sta.pmf_cfg.required =
false;
174 conf.sta.threshold.rssi = -127;
176 conf.sta.threshold.authmode = WIFI_AUTH_OPEN;
178 wifi_config_t current_conf;
180 err = esp_wifi_get_config(WIFI_IF_STA, ¤t_conf);
182 ESP_LOGW(TAG,
"esp_wifi_get_config failed: %s", esp_err_to_name(err));
186 if (memcmp(¤t_conf, &conf,
sizeof(wifi_config_t)) != 0) {
187 err = esp_wifi_disconnect();
189 ESP_LOGV(TAG,
"esp_wifi_disconnect failed: %s", esp_err_to_name(err));
194 err = esp_wifi_set_config(WIFI_IF_STA, &conf);
196 ESP_LOGV(TAG,
"esp_wifi_set_config failed: %s", esp_err_to_name(err));
205 #ifdef USE_WIFI_WPA2_EAP 206 if (ap.
get_eap().has_value()) {
209 err = esp_wifi_sta_wpa2_ent_set_identity((uint8_t *) eap.
identity.c_str(), eap.
identity.length());
211 ESP_LOGV(TAG,
"esp_wifi_sta_wpa2_ent_set_identity failed! %d", err);
213 int ca_cert_len = strlen(eap.
ca_cert);
217 err = esp_wifi_sta_wpa2_ent_set_ca_cert((uint8_t *) eap.
ca_cert, ca_cert_len + 1);
219 ESP_LOGV(TAG,
"esp_wifi_sta_wpa2_ent_set_ca_cert failed! %d", err);
224 if (client_cert_len && client_key_len) {
226 err = esp_wifi_sta_wpa2_ent_set_cert_key((uint8_t *) eap.
client_cert, client_cert_len + 1,
227 (uint8_t *) eap.
client_key, client_key_len + 1,
230 ESP_LOGV(TAG,
"esp_wifi_sta_wpa2_ent_set_cert_key failed! %d", err);
234 err = esp_wifi_sta_wpa2_ent_set_username((uint8_t *) eap.
username.c_str(), eap.
username.length());
236 ESP_LOGV(TAG,
"esp_wifi_sta_wpa2_ent_set_username failed! %d", err);
238 err = esp_wifi_sta_wpa2_ent_set_password((uint8_t *) eap.
password.c_str(), eap.
password.length());
240 ESP_LOGV(TAG,
"esp_wifi_sta_wpa2_ent_set_password failed! %d", err);
243 err = esp_wifi_sta_wpa2_ent_enable();
245 ESP_LOGV(TAG,
"esp_wifi_sta_wpa2_ent_enable failed! %d", err);
248 #endif // USE_WIFI_WPA2_EAP 252 s_sta_connecting =
true;
254 err = esp_wifi_connect();
256 ESP_LOGW(TAG,
"esp_wifi_connect failed: %s", esp_err_to_name(err));
268 esp_netif_dhcp_status_t dhcp_status;
269 esp_err_t err = esp_netif_dhcpc_get_status(s_sta_netif, &dhcp_status);
271 ESP_LOGV(TAG,
"esp_netif_dhcpc_get_status failed: %s", esp_err_to_name(err));
279 sntp_servermode_dhcp(
false);
282 if (dhcp_status != ESP_NETIF_DHCP_STARTED) {
283 err = esp_netif_dhcpc_start(s_sta_netif);
285 ESP_LOGV(TAG,
"Starting DHCP client failed! %d", err);
287 return err == ESP_OK;
292 esp_netif_ip_info_t info;
293 info.ip = manual_ip->static_ip;
294 info.gw = manual_ip->gateway;
295 info.netmask = manual_ip->subnet;
296 err = esp_netif_dhcpc_stop(s_sta_netif);
297 if (err != ESP_OK && err != ESP_ERR_ESP_NETIF_DHCP_ALREADY_STOPPED) {
298 ESP_LOGV(TAG,
"Stopping DHCP client failed! %s", esp_err_to_name(err));
301 err = esp_netif_set_ip_info(s_sta_netif, &info);
303 ESP_LOGV(TAG,
"Setting manual IP info failed! %s", esp_err_to_name(err));
306 esp_netif_dns_info_t dns;
307 if (manual_ip->dns1.is_set()) {
308 dns.ip = manual_ip->dns1;
309 esp_netif_set_dns_info(s_sta_netif, ESP_NETIF_DNS_MAIN, &dns);
311 if (manual_ip->dns2.is_set()) {
312 dns.ip = manual_ip->dns2;
313 esp_netif_set_dns_info(s_sta_netif, ESP_NETIF_DNS_BACKUP, &dns);
323 esp_netif_ip_info_t ip;
324 esp_err_t err = esp_netif_get_ip_info(s_sta_netif, &ip);
326 ESP_LOGV(TAG,
"esp_netif_get_ip_info failed: %s", esp_err_to_name(err));
333 struct esp_ip6_addr if_ip6s[CONFIG_LWIP_IPV6_NUM_ADDRESSES];
335 count = esp_netif_get_all_ip6(s_sta_netif, if_ip6s);
336 assert(count <= CONFIG_LWIP_IPV6_NUM_ADDRESSES);
337 for (
int i = 0; i < count; i++) {
354 case WIFI_AUTH_WPA_PSK:
356 case WIFI_AUTH_WPA2_PSK:
358 case WIFI_AUTH_WPA_WPA2_PSK:
359 return "WPA/WPA2 PSK";
360 case WIFI_AUTH_WPA2_ENTERPRISE:
361 return "WPA2 Enterprise";
362 case WIFI_AUTH_WPA3_PSK:
364 case WIFI_AUTH_WPA2_WPA3_PSK:
365 return "WPA2/WPA3 PSK";
366 case WIFI_AUTH_WAPI_PSK:
377 sprintf(buf,
"%u.%u.%u.%u", uint8_t(ip.addr >> 0), uint8_t(ip.addr >> 8), uint8_t(ip.addr >> 16),
378 uint8_t(ip.addr >> 24));
397 case WIFI_REASON_AUTH_EXPIRE:
398 return "Auth Expired";
399 case WIFI_REASON_AUTH_LEAVE:
401 case WIFI_REASON_ASSOC_EXPIRE:
402 return "Association Expired";
403 case WIFI_REASON_ASSOC_TOOMANY:
404 return "Too Many Associations";
405 case WIFI_REASON_NOT_AUTHED:
406 return "Not Authenticated";
407 case WIFI_REASON_NOT_ASSOCED:
408 return "Not Associated";
409 case WIFI_REASON_ASSOC_LEAVE:
410 return "Association Leave";
411 case WIFI_REASON_ASSOC_NOT_AUTHED:
412 return "Association not Authenticated";
413 case WIFI_REASON_DISASSOC_PWRCAP_BAD:
414 return "Disassociate Power Cap Bad";
415 case WIFI_REASON_DISASSOC_SUPCHAN_BAD:
416 return "Disassociate Supported Channel Bad";
417 case WIFI_REASON_IE_INVALID:
419 case WIFI_REASON_MIC_FAILURE:
420 return "Mic Failure";
421 case WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT:
422 return "4-Way Handshake Timeout";
423 case WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT:
424 return "Group Key Update Timeout";
425 case WIFI_REASON_IE_IN_4WAY_DIFFERS:
426 return "IE In 4-Way Handshake Differs";
427 case WIFI_REASON_GROUP_CIPHER_INVALID:
428 return "Group Cipher Invalid";
429 case WIFI_REASON_PAIRWISE_CIPHER_INVALID:
430 return "Pairwise Cipher Invalid";
431 case WIFI_REASON_AKMP_INVALID:
432 return "AKMP Invalid";
433 case WIFI_REASON_UNSUPP_RSN_IE_VERSION:
434 return "Unsupported RSN IE version";
435 case WIFI_REASON_INVALID_RSN_IE_CAP:
436 return "Invalid RSN IE Cap";
437 case WIFI_REASON_802_1X_AUTH_FAILED:
438 return "802.1x Authentication Failed";
439 case WIFI_REASON_CIPHER_SUITE_REJECTED:
440 return "Cipher Suite Rejected";
441 case WIFI_REASON_BEACON_TIMEOUT:
442 return "Beacon Timeout";
443 case WIFI_REASON_NO_AP_FOUND:
444 return "AP Not Found";
445 case WIFI_REASON_AUTH_FAIL:
446 return "Authentication Failed";
447 case WIFI_REASON_ASSOC_FAIL:
448 return "Association Failed";
449 case WIFI_REASON_HANDSHAKE_TIMEOUT:
450 return "Handshake Failed";
451 case WIFI_REASON_CONNECTION_FAIL:
452 return "Connection Failed";
453 case WIFI_REASON_ROAMING:
454 return "Station Roaming";
455 case WIFI_REASON_UNSPECIFIED:
457 return "Unspecified";
463 #define ESPHOME_EVENT_ID_WIFI_READY ARDUINO_EVENT_WIFI_READY 464 #define ESPHOME_EVENT_ID_WIFI_SCAN_DONE ARDUINO_EVENT_WIFI_SCAN_DONE 465 #define ESPHOME_EVENT_ID_WIFI_STA_START ARDUINO_EVENT_WIFI_STA_START 466 #define ESPHOME_EVENT_ID_WIFI_STA_STOP ARDUINO_EVENT_WIFI_STA_STOP 467 #define ESPHOME_EVENT_ID_WIFI_STA_CONNECTED ARDUINO_EVENT_WIFI_STA_CONNECTED 468 #define ESPHOME_EVENT_ID_WIFI_STA_DISCONNECTED ARDUINO_EVENT_WIFI_STA_DISCONNECTED 469 #define ESPHOME_EVENT_ID_WIFI_STA_AUTHMODE_CHANGE ARDUINO_EVENT_WIFI_STA_AUTHMODE_CHANGE 470 #define ESPHOME_EVENT_ID_WIFI_STA_GOT_IP ARDUINO_EVENT_WIFI_STA_GOT_IP 471 #define ESPHOME_EVENT_ID_WIFI_STA_GOT_IP6 ARDUINO_EVENT_WIFI_STA_GOT_IP6 472 #define ESPHOME_EVENT_ID_WIFI_STA_LOST_IP ARDUINO_EVENT_WIFI_STA_LOST_IP 473 #define ESPHOME_EVENT_ID_WIFI_AP_START ARDUINO_EVENT_WIFI_AP_START 474 #define ESPHOME_EVENT_ID_WIFI_AP_STOP ARDUINO_EVENT_WIFI_AP_STOP 475 #define ESPHOME_EVENT_ID_WIFI_AP_STACONNECTED ARDUINO_EVENT_WIFI_AP_STACONNECTED 476 #define ESPHOME_EVENT_ID_WIFI_AP_STADISCONNECTED ARDUINO_EVENT_WIFI_AP_STADISCONNECTED 477 #define ESPHOME_EVENT_ID_WIFI_AP_STAIPASSIGNED ARDUINO_EVENT_WIFI_AP_STAIPASSIGNED 478 #define ESPHOME_EVENT_ID_WIFI_AP_PROBEREQRECVED ARDUINO_EVENT_WIFI_AP_PROBEREQRECVED 479 #define ESPHOME_EVENT_ID_WIFI_AP_GOT_IP6 ARDUINO_EVENT_WIFI_AP_GOT_IP6 485 case ESPHOME_EVENT_ID_WIFI_READY: {
486 ESP_LOGV(TAG,
"Event: WiFi ready");
489 case ESPHOME_EVENT_ID_WIFI_SCAN_DONE: {
490 auto it = info.wifi_scan_done;
491 ESP_LOGV(TAG,
"Event: WiFi Scan Done status=%u number=%u scan_id=%u", it.status, it.number, it.scan_id);
496 case ESPHOME_EVENT_ID_WIFI_STA_START: {
497 ESP_LOGV(TAG,
"Event: WiFi STA start");
499 s_sta_netif = esp_netif_get_handle_from_ifkey(
"WIFI_STA_DEF");
500 esp_err_t err = esp_netif_set_hostname(s_sta_netif,
App.
get_name().c_str());
502 ESP_LOGW(TAG,
"esp_netif_set_hostname failed: %s", esp_err_to_name(err));
506 case ESPHOME_EVENT_ID_WIFI_STA_STOP: {
507 ESP_LOGV(TAG,
"Event: WiFi STA stop");
510 case ESPHOME_EVENT_ID_WIFI_STA_CONNECTED: {
511 auto it = info.wifi_sta_connected;
513 memcpy(buf, it.ssid, it.ssid_len);
514 buf[it.ssid_len] =
'\0';
515 ESP_LOGV(TAG,
"Event: Connected ssid='%s' bssid=" LOG_SECRET(
"%s")
" channel=%u, authmode=%s", buf,
523 case ESPHOME_EVENT_ID_WIFI_STA_DISCONNECTED: {
524 auto it = info.wifi_sta_disconnected;
526 memcpy(buf, it.ssid, it.ssid_len);
527 buf[it.ssid_len] =
'\0';
528 if (it.reason == WIFI_REASON_NO_AP_FOUND) {
529 ESP_LOGW(TAG,
"Event: Disconnected ssid='%s' reason='Probe Request Unsuccessful'", buf);
531 ESP_LOGW(TAG,
"Event: Disconnected ssid='%s' bssid=" LOG_SECRET(
"%s")
" reason='%s'", buf,
535 uint8_t reason = it.reason;
536 if (reason == WIFI_REASON_AUTH_EXPIRE || reason == WIFI_REASON_BEACON_TIMEOUT ||
537 reason == WIFI_REASON_NO_AP_FOUND || reason == WIFI_REASON_ASSOC_FAIL ||
538 reason == WIFI_REASON_HANDSHAKE_TIMEOUT) {
539 err_t err = esp_wifi_disconnect();
541 ESP_LOGV(TAG,
"Disconnect failed: %s", esp_err_to_name(err));
546 s_sta_connecting =
false;
549 case ESPHOME_EVENT_ID_WIFI_STA_AUTHMODE_CHANGE: {
550 auto it = info.wifi_sta_authmode_change;
551 ESP_LOGV(TAG,
"Event: Authmode Change old=%s new=%s",
get_auth_mode_str(it.old_mode),
555 if (it.old_mode != WIFI_AUTH_OPEN && it.new_mode == WIFI_AUTH_OPEN) {
556 ESP_LOGW(TAG,
"Potential Authmode downgrade detected, disconnecting...");
559 err_t err = esp_wifi_disconnect();
561 ESP_LOGW(TAG,
"Disconnect failed: %s", esp_err_to_name(err));
567 case ESPHOME_EVENT_ID_WIFI_STA_GOT_IP: {
568 auto it = info.got_ip.ip_info;
569 ESP_LOGV(TAG,
"Event: Got IP static_ip=%s gateway=%s",
format_ip4_addr(it.ip).c_str(),
575 s_sta_connecting =
false;
580 case ESPHOME_EVENT_ID_WIFI_STA_GOT_IP6: {
581 auto it = info.got_ip6.ip6_info;
582 ESP_LOGV(TAG,
"Got IPv6 address=" IPV6STR, IPV62STR(it.ip));
588 case ESPHOME_EVENT_ID_WIFI_STA_LOST_IP: {
589 ESP_LOGV(TAG,
"Event: Lost IP");
593 case ESPHOME_EVENT_ID_WIFI_AP_START: {
594 ESP_LOGV(TAG,
"Event: WiFi AP start");
597 case ESPHOME_EVENT_ID_WIFI_AP_STOP: {
598 ESP_LOGV(TAG,
"Event: WiFi AP stop");
601 case ESPHOME_EVENT_ID_WIFI_AP_STACONNECTED: {
602 auto it = info.wifi_sta_connected;
603 auto &mac = it.bssid;
604 ESP_LOGV(TAG,
"Event: AP client connected MAC=%s",
format_mac_addr(mac).c_str());
607 case ESPHOME_EVENT_ID_WIFI_AP_STADISCONNECTED: {
608 auto it = info.wifi_sta_disconnected;
609 auto &mac = it.bssid;
610 ESP_LOGV(TAG,
"Event: AP client disconnected MAC=%s",
format_mac_addr(mac).c_str());
613 case ESPHOME_EVENT_ID_WIFI_AP_STAIPASSIGNED: {
614 ESP_LOGV(TAG,
"Event: AP client assigned IP");
617 case ESPHOME_EVENT_ID_WIFI_AP_PROBEREQRECVED: {
618 auto it = info.wifi_ap_probereqrecved;
619 ESP_LOGVV(TAG,
"Event: AP receive Probe Request MAC=%s RSSI=%d",
format_mac_addr(it.mac).c_str(), it.rssi);
629 if (
status == WL_CONNECT_FAILED ||
status == WL_CONNECTION_LOST) {
632 if (
status == WL_NO_SSID_AVAIL) {
635 if (s_sta_connecting) {
638 if (
status == WL_CONNECTED) {
649 int16_t err = WiFi.scanNetworks(
true,
true, passive, 200);
650 if (err != WIFI_SCAN_RUNNING) {
651 ESP_LOGV(TAG,
"WiFi.scanNetworks failed! %d", err);
660 int16_t num = WiFi.scanComplete();
664 this->
scan_result_.reserve(static_cast<unsigned int>(num));
665 for (
int i = 0; i < num; i++) {
666 String ssid = WiFi.SSID(i);
667 wifi_auth_mode_t authmode = WiFi.encryptionType(i);
668 int32_t rssi = WiFi.RSSI(i);
669 uint8_t *bssid = WiFi.BSSID(i);
670 int32_t channel = WiFi.channel(i);
672 WiFiScanResult scan({bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]}, std::string(ssid.c_str()),
673 channel, rssi, authmode != WIFI_AUTH_OPEN, ssid.length() == 0);
688 esp_netif_ip_info_t info;
690 info.ip = manual_ip->static_ip;
691 info.gw = manual_ip->gateway;
692 info.netmask = manual_ip->subnet;
699 err = esp_netif_dhcps_stop(s_ap_netif);
700 if (err != ESP_OK && err != ESP_ERR_ESP_NETIF_DHCP_ALREADY_STOPPED) {
701 ESP_LOGE(TAG,
"esp_netif_dhcps_stop failed: %s", esp_err_to_name(err));
705 err = esp_netif_set_ip_info(s_ap_netif, &info);
707 ESP_LOGE(TAG,
"esp_netif_set_ip_info failed! %d", err);
715 lease.start_ip = start_address;
716 ESP_LOGV(TAG,
"DHCP server IP lease start: %s", start_address.
str().c_str());
718 lease.end_ip = start_address;
719 ESP_LOGV(TAG,
"DHCP server IP lease end: %s", start_address.str().c_str());
720 err = esp_netif_dhcps_option(s_ap_netif, ESP_NETIF_OP_SET, ESP_NETIF_REQUESTED_IP_ADDRESS, &lease,
sizeof(lease));
723 ESP_LOGE(TAG,
"esp_netif_dhcps_option failed! %d", err);
727 err = esp_netif_dhcps_start(s_ap_netif);
730 ESP_LOGE(TAG,
"esp_netif_dhcps_start failed! %d", err);
743 memset(&conf, 0,
sizeof(conf));
744 strncpy(reinterpret_cast<char *>(conf.ap.ssid), ap.
get_ssid().c_str(),
sizeof(conf.ap.ssid));
746 conf.ap.ssid_hidden = ap.
get_ssid().size();
747 conf.ap.max_connection = 5;
748 conf.ap.beacon_interval = 100;
751 conf.ap.authmode = WIFI_AUTH_OPEN;
752 *conf.ap.password = 0;
754 conf.ap.authmode = WIFI_AUTH_WPA2_PSK;
755 strncpy(reinterpret_cast<char *>(conf.ap.password), ap.
get_password().c_str(),
sizeof(conf.ap.password));
759 conf.ap.pairwise_cipher = WIFI_CIPHER_TYPE_CCMP;
761 esp_err_t err = esp_wifi_set_config(WIFI_IF_AP, &conf);
763 ESP_LOGV(TAG,
"esp_wifi_set_config failed! %d", err);
770 ESP_LOGV(TAG,
"wifi_ap_ip_config_ failed!");
778 esp_netif_ip_info_t ip;
779 esp_netif_get_ip_info(s_ap_netif, &ip);
782 #endif // USE_WIFI_AP 788 uint8_t *raw_bssid = WiFi.BSSID();
789 if (raw_bssid !=
nullptr) {
790 for (
size_t i = 0; i < bssid.size(); i++)
791 bssid[i] = raw_bssid[i];
805 #endif // USE_ESP32_FRAMEWORK_ARDUINO
WiFiSTAConnectStatus wifi_sta_connect_status_()
std::array< uint8_t, 6 > bssid_t
const optional< EAPAuth > & get_eap() const
static std::string format_mac_addr(const uint8_t mac[6])
const std::string & get_password() const
WiFiPowerSaveMode power_save_
network::IPAddress wifi_dns_ip_(int num)
network::IPAddresses wifi_sta_ip_addresses()
bool wifi_mode_(optional< bool > sta, optional< bool > ap)
const optional< bssid_t > & get_bssid() const
void set_timeout(const std::string &name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
bool wifi_apply_output_power_(float output_power)
esp_ip4_addr_t esphome_ip4_addr_t
bool wifi_sta_ip_config_(optional< ManualIP > manual_ip)
network::IPAddress wifi_subnet_mask_()
void set_ap(const WiFiAP &ap)
Setup an Access Point that should be created if no connection to a station can be made...
bool wifi_apply_hostname_()
bool error_from_callback_
const char * get_op_mode_str(uint8_t mode)
std::vector< WiFiScanResult > scan_result_
bool wifi_start_ap_(const WiFiAP &ap)
const optional< ManualIP > & get_manual_ip() const
const optional< uint8_t > & get_channel() const
arduino_event_id_t esphome_wifi_event_id_t
BedjetMode mode
BedJet operating mode.
bool wifi_apply_power_save_()
Application App
Global storage of Application pointer - only one Application can exist.
bool wifi_ap_ip_config_(optional< ManualIP > manual_ip)
const std::string & get_name() const
Get the name of this Application set by pre_setup().
std::array< IPAddress, 5 > IPAddresses
network::IPAddress wifi_soft_ap_ip()
void wifi_event_callback_(arduino_event_id_t event, arduino_event_info_t info)
arduino_event_info_t esphome_wifi_event_info_t
bool wifi_sta_pre_setup_()
const char * get_auth_mode_str(uint8_t mode)
void IRAM_ATTR HOT yield()
network::IPAddress wifi_gateway_ip_()
bool wifi_scan_start_(bool passive)
uint8_t num_ipv6_addresses_
void set_sta(const WiFiAP &ap)
Implementation of SPI Controller mode.
std::string format_ip4_addr(const esphome_ip4_addr_t &ip)
const std::string & get_ssid() const
const char * get_disconnect_reason_str(uint8_t reason)
void wifi_scan_done_callback_()
value_type value_or(U const &v) const
bool wifi_sta_connect_(const WiFiAP &ap)
void IRAM_ATTR HOT delay(uint32_t ms)