diff --git a/esphome/components/wifi/wifi_component.cpp b/esphome/components/wifi/wifi_component.cpp index 31ebf481db..95d89dfc4f 100644 --- a/esphome/components/wifi/wifi_component.cpp +++ b/esphome/components/wifi/wifi_component.cpp @@ -965,11 +965,8 @@ const LogString *get_signal_bars(int8_t rssi) { } void WiFiComponent::print_connect_params_() { - if (this->is_disabled() || !this->is_connected()) { - return; - } bssid_t bssid = wifi_bssid(); - char bssid_s[18]; + char bssid_s[MAC_ADDRESS_PRETTY_BUFFER_SIZE]; format_mac_addr_upper(bssid.data(), bssid_s); // Use stack buffers for IP address formatting to avoid heap allocations char ip_buf[network::IP_ADDRESS_BUFFER_SIZE]; @@ -1242,7 +1239,7 @@ void WiFiComponent::check_scanning_finished() { } void WiFiComponent::dump_config() { - char mac_s[18]; + char mac_s[MAC_ADDRESS_PRETTY_BUFFER_SIZE]; ESP_LOGCONFIG(TAG, "WiFi:\n" " Local MAC: %s\n" @@ -1250,8 +1247,11 @@ void WiFiComponent::dump_config() { get_mac_address_pretty_into_buffer(mac_s), YESNO(this->is_connected())); if (this->is_disabled()) { ESP_LOGCONFIG(TAG, " Disabled"); + return; + } + if (this->is_connected()) { + this->print_connect_params_(); } - this->print_connect_params_(); } void WiFiComponent::check_connecting_finished(uint32_t now) {