From 51dfb3af5e065fa31fcd9eb1bd94b53d1f758715 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 12 Jan 2026 00:23:09 -1000 Subject: [PATCH] [nfc] Use stack-based hex formatting in pn7150/pn7160 components --- esphome/components/nfc/automation.cpp | 3 +-- esphome/components/nfc/binary_sensor/nfc_binary_sensor.cpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/esphome/components/nfc/automation.cpp b/esphome/components/nfc/automation.cpp index 3a45dbdb18..e2956e4c12 100644 --- a/esphome/components/nfc/automation.cpp +++ b/esphome/components/nfc/automation.cpp @@ -6,8 +6,7 @@ namespace nfc { void NfcOnTagTrigger::process(const std::unique_ptr &tag) { char uid_buf[FORMAT_UID_BUFFER_SIZE]; - format_uid_to(uid_buf, tag->get_uid()); - this->trigger(std::string(uid_buf), *tag); + this->trigger(std::string(format_uid_to(uid_buf, tag->get_uid())), *tag); } } // namespace nfc diff --git a/esphome/components/nfc/binary_sensor/nfc_binary_sensor.cpp b/esphome/components/nfc/binary_sensor/nfc_binary_sensor.cpp index 0f5b7db117..b62b243cc6 100644 --- a/esphome/components/nfc/binary_sensor/nfc_binary_sensor.cpp +++ b/esphome/components/nfc/binary_sensor/nfc_binary_sensor.cpp @@ -26,8 +26,7 @@ void NfcTagBinarySensor::dump_config() { } if (!this->uid_.empty()) { char uid_buf[FORMAT_BYTES_BUFFER_SIZE]; - format_bytes_to(uid_buf, this->uid_); - ESP_LOGCONFIG(TAG, " Tag UID: %s", uid_buf); + ESP_LOGCONFIG(TAG, " Tag UID: %s", format_bytes_to(uid_buf, this->uid_)); } }