diff --git a/esphome/components/bthome_mithermometer/bthome_ble.cpp b/esphome/components/bthome_mithermometer/bthome_ble.cpp index 762fc68b03..d1c5165896 100644 --- a/esphome/components/bthome_mithermometer/bthome_ble.cpp +++ b/esphome/components/bthome_mithermometer/bthome_ble.cpp @@ -4,6 +4,7 @@ #include "esphome/core/log.h" #include +#include #ifdef USE_ESP32 @@ -12,14 +13,14 @@ namespace bthome_mithermometer { static const char *const TAG = "bthome_mithermometer"; -static const char *format_mac_address(char *buffer, uint64_t address) { +static const char *format_mac_address(std::span buffer, uint64_t address) { std::array mac{}; for (size_t i = 0; i < MAC_ADDRESS_SIZE; i++) { mac[i] = (address >> ((MAC_ADDRESS_SIZE - 1 - i) * 8)) & 0xFF; } - format_mac_addr_upper(mac.data(), buffer); - return buffer; + format_mac_addr_upper(mac.data(), buffer.data()); + return buffer.data(); } static bool get_bthome_value_length(uint8_t obj_type, size_t &value_length) {