From b432c056dc58454f21c2fcdf76fb2e8d2f52ddec Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 23 Nov 2025 20:48:27 -0600 Subject: [PATCH] [esp32_ble] Store device name in flash to reduce RAM usage --- esphome/components/esp32_ble/ble.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/esphome/components/esp32_ble/ble.cpp b/esphome/components/esp32_ble/ble.cpp index b0683b9e65..86c750e8f8 100644 --- a/esphome/components/esp32_ble/ble.cpp +++ b/esphome/components/esp32_ble/ble.cpp @@ -261,8 +261,9 @@ bool ESP32BLE::ble_setup_() { if (App.is_name_add_mac_suffix_enabled()) { // MAC address suffix length (last 6 characters of 12-char MAC address string) constexpr size_t mac_address_suffix_len = 6; - const std::string mac_addr = get_mac_address(); - const char *mac_suffix_ptr = mac_addr.c_str() + mac_address_suffix_len; + char mac_addr[13]; + get_mac_address_into_buffer(mac_addr); + const char *mac_suffix_ptr = mac_addr + mac_address_suffix_len; name = make_name_with_suffix(this->name_, '-', mac_suffix_ptr, mac_address_suffix_len); } else { name = this->name_;