ESPHome with PN532 - Read Tag Text

Hi folks! Many of you using PN532 integration on ESPHome for NFC? Is there any way to actually pass the text stores on the tag as a single sensor that reports the text, as opposed to having to create a unique binary sensor for each tag?

I have a project I am working on that will have over 100 NFC tags that need to be read, but also needs to be fluid and easy to add and change. If I can simply pass the text off the tag to a single sensor, I have automations written in Node Red that accomplishes everything I need to do

I have been working to do this using Arduino IDE but am having lots of Wi-Fi issues once the 532 is integrated

Many thanks in advance for any insights offered!

Maybe the esp-rfid projects fits your needs as it even comes with a web ui for managing the tags

Not sure I understood correctly your need, but I think this accomplishes what you are seeking to achieve:

pn532:
  cs_pin: D3
  update_interval: 1s
  on_tag:
    then:
      - mqtt.publish:
          topic: myhome/keypad/tag
          payload: !lambda 'return x;'

basically when a tag is detected, a message is published to that mqtt topic with the 8-digit code of that tag.

If you use the API, try this:

pn532:
  cs_pin: 21
  update_interval: 1s
  on_tag:
    then:
    - text_sensor.template.publish:
        id: rfid_tag
        state: !lambda 'return x;'
            
text_sensor:
  - platform: template
    name: "RFID Tag"
    id: rfid_tag

Taken from:

1 Like