[nfc] Pass tags to triggers by reference and keep the listener list in static storage (#19902)

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Keith Burzinski
2026-09-29 15:00:23 -05:00
committed by GitHub
co-authored by Claude Fable 5.1
parent 6b465443bc
commit 662c7db222
15 changed files with 54 additions and 28 deletions
+9
View File
@@ -1,6 +1,15 @@
pn532_spi:
id: pn532_nfcc_spi
cs_pin: ${cs_pin}
on_tag:
then:
- delay: 10ms
- lambda: |-
ESP_LOGD("test", "%s %zu %d %d", tag.get_tag_type().c_str(), tag.get_uid().size(), tag.has_ndef_message(),
nfc::has_ha_tag_ndef(tag));
on_tag_removed:
then:
- lambda: ESP_LOGD("test", "%s", tag.get_tag_type().c_str());
binary_sensor:
- platform: pn532
+13 -2
View File
@@ -24,8 +24,19 @@ pn7160_spi:
emulation_message: https://www.home-assistant.io/tag/pulse_ce
tag_ttl: 1000ms
on_tag:
- logger.log: "Tag"
then:
- delay: 10ms
- lambda: |-
ESP_LOGD("test", "%s %zu %d %s", tag.get_tag_type().c_str(), tag.get_uid().size(), tag.has_ndef_message(),
nfc::get_ha_tag_ndef(tag).c_str());
on_tag_removed:
- logger.log: "Tag removed"
then:
- lambda: ESP_LOGD("test", "%s", tag.get_tag_type().c_str());
on_emulated_tag_scan:
- logger.log: "Tag emulated"
binary_sensor:
- platform: nfc
nfcc_id: nfcc_pn7160_spi
name: Pulse tag
ndef_contains: pulse