mirror of
https://github.com/esphome/esphome.git
synced 2026-10-07 03:16:37 +00:00
[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:
co-authored by
Claude Fable 5.1
parent
6b465443bc
commit
662c7db222
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user