diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 2cf941f29a..49e57bd146 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -885,13 +885,19 @@ template::value, int> = 0> ESPDEPRECATED("Allocates heap memory. Use format_hex_to() with stack buffer. Removed in 2026.7.0.", "2026.1.0") std::string format_hex(T val) { val = convert_big_endian(val); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" return format_hex(reinterpret_cast(&val), sizeof(T)); +#pragma GCC diagnostic pop } /// @deprecated Allocates heap memory. Use format_hex_to() with a stack buffer instead. Removed in 2026.7.0. template ESPDEPRECATED("Allocates heap memory. Use format_hex_to() with stack buffer. Removed in 2026.7.0.", "2026.1.0") std::string format_hex(const std::array &data) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" return format_hex(data.data(), data.size()); +#pragma GCC diagnostic pop } /** Format a byte array in pretty-printed, human-readable hex format.