From d80885c7a8868b8bd4b25cb7d2a262282d82d622 Mon Sep 17 00:00:00 2001 From: Jimmy Hedman Date: Thu, 11 May 2023 00:00:28 +0200 Subject: [PATCH] Fixed access point for ESP32 IDF platform (#4784) --- esphome/components/wifi/wifi_component_esp_idf.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/esphome/components/wifi/wifi_component_esp_idf.cpp b/esphome/components/wifi/wifi_component_esp_idf.cpp index 1c70f33040..e18d3cc043 100644 --- a/esphome/components/wifi/wifi_component_esp_idf.cpp +++ b/esphome/components/wifi/wifi_component_esp_idf.cpp @@ -767,11 +767,10 @@ bool WiFiComponent::wifi_ap_ip_config_(optional manual_ip) { info.gw.addr = static_cast(network::IPAddress(192, 168, 4, 1)); info.netmask.addr = static_cast(network::IPAddress(255, 255, 255, 0)); } - esp_netif_dhcp_status_t dhcp_status; - esp_netif_dhcps_get_status(s_sta_netif, &dhcp_status); - err = esp_netif_dhcps_stop(s_sta_netif); - if (err != ESP_OK) { - ESP_LOGV(TAG, "esp_netif_dhcps_stop failed! %d", err); + + err = esp_netif_dhcpc_stop(s_sta_netif); + if (err != ESP_OK && err != ESP_ERR_ESP_NETIF_DHCP_ALREADY_STOPPED) { + ESP_LOGV(TAG, "esp_netif_dhcpc_stop failed: %s", esp_err_to_name(err)); return false; }