PN532 and one binary sensors for several Tags

Hi,

I am setting up a alarm system and are using one NodeMCU with a PN532 RFID reader to disarm the alarm. I am using ESPHome to interakt with the Device and that works like a charm :slight_smile:

To make it easy for me, I am thinking of using one binary sensor for all approved tags. Is it possible? I havent found any example of that.

From the ESPHome wiki:

binary_sensor:
  - platform: pn532
    uid: 74-10-37-94
    name: "PN532 NFC Tag"

Is there any easy way to have several uid’s for the same sensor?

Would you please share your code? I would like to do something similar.
To answer your question, I think that what you need is setup all your tags as a separate binary sensor for each tag. Then you need to create a template binary sensor where you use a lambda value for it.

binary_sensor:
  - platform: pn532
    uid: 74-10-37-94
    name: "Tag1"

 - platform: pn532
   uid: XXXXXXX
   name: "Tag2"

  - platform: template
    name: "Any Tag"
    lambda: |-
      return ((id(tag1).state) || (id(tag2).state) ); 

Maybe you need to also publish the state of the templated binary sensor when the value of any of the tags change. Take a look at:

1 Like

Hi,

Thanks for the hint regarding using Template binary sensor for all tags. I will try it next time :slight_smile: but first I have to fix the hard ware. Currently I have to weak signal strength in the garage for the module…