Home Assistant Tags

![](upload://4g7nH1Q4Cr14mnLyMcGOeCEuaLa.jpeg)

RFID tags have been on my radar for home automation since @hoveeman published this video two years ago of him using RFID cards to play music in his house.

It has been my dream ever since to get this easily accessible to every Home Assistant user. It already got a lot more accessible when @maddox released Magic Cards. But this was still a separate application that you had to run besides Home Assistant, and it required a separate RFID reader.

Can we do better? Yes, we can. Today we are introducing Home Assistant Tags. A collaboration between our iOS, Android, frontend, core and hardware groups. With Home Assistant Tags, we’re making scannable tags (NFC/RFID) a first-class citizen in Home Assistant. Easy to read, write and automate!

The Apps

The official Home Assistant apps have been updated with NFC support. This dramatically lowers the bar for starting to automate your house with NFC tags. All you need now is tags!

From the apps you can now write a special Home Assistant URL to tags. Once you hover over one of these tags with your phone, they will trigger the Home Assistant app and send the identifier to your Home Assistant instance for processing. Tags are not bound to the phone that wrote them, any phone can scan them.

Thanks to @David-Development for the NFC support in the Android app and thanks to @zacwest for the NFC support in the iOS app.

Only iPhone XS, XR and iPhone 11 or later support background NFC tag reading.

Standalone Tag Reader

Having mobile tag readers is great, but there is more! The original RFID jukebox that peaked my interest worked with a dedicated RFID reader. This RFID reader was connected to a Raspberry Pi that was running a script to read the tags and send them to Home Assistant.

![](upload://pi03RThAT56ajAc26cuOs7g77bu.jpeg) Photo of the old system.

These solutions work great but were bulky and required hardware skills and technical skills to set up. The hardware cost for building a single reader could be around $30 (RFID reader + Raspberry Pi 0), but that’s just for 1 room. What if you want more rooms? That adds up quickly.

@adonno, with the help of @MagnusO, has been working on a smaller tag reader based on ESPHome. It’s powered by an ESP8266 chip and a PN532 NFC module. The case is 3D printed.

Because it’s powered by ESPHome, setting up is a breeze. Once powered on, it will create an access point that allows you to add your WiFi configuration. After that Home Assistant will pick it up and you can start scanning tags.

![](upload://ery6twLkveV6EOQXTJKqMKI68X3.jpeg)

The nice thing about standalone tag readers is that they are dedicated to a room. This means automations know in which room to act when a music card is scanned and can pick the right media player. This makes it easy to have cards that can work in every room.

The tag reader is open-source and available on GitHub. You can make one yourself or buy one of the pre-built ones or DIY kits that Adonno is selling.

Managing Tags in Home Assistant 0.115

Home Assistant 0.115 will contain a brand new tag manager, thanks to @bramkragten and @dmulcahey. On this screen you can create new tags, see the tags that have been scanned and can easily create automations for each tag. The new UI tightly integrates with the mobile apps, allowing you to write existing IDs to new tags with the tap of a button.

![](upload://folg3TMtC7AJleg0cUGygafxdQ1.gif)

Building the RFID jukebox

All previous things put the pieces in place for us to be able to build our own jukebox. We can do this with just a few lines of YAML using some of the cool new features coming in Home Assistant 0.115:

# Note, this is using new automation features introduced in Home Assistant 0.115
automation:
- id: handle_tag_scan
  alias: Handle Tag Scan
  mode: single
  # Hide warnings when triggered while in delay.
  max_exceeded: silent
  variables:
    # Map scanner device ID to media player entity ID
    media_players:
      0e19cd3cf2b311ea88f469a7512c307d: media_player.spotify_balloob
    # Map tag ID to content
    tags:
      A7-6B-90-5F:
        media_content_id: spotify:album:0h2knr6qpiAq0tV5ri5JMF
        media_content_type: album
      04-B1-C6-62-2F-64-80:
        media_content_id: spotify:playlist:0OtWh3u6fZrBJTQtVBQWge
        media_content_type: playlist
  trigger:
    platform: event
    event_type: tag_scanned
  condition:
    # Test that we support this device and tag
    - "{{ trigger.event.data.tag_id in tags }}"
    - "{{ trigger.event.data.device_id in media_players }}"
  action:
    - variables:
        media_player_entity_id: "{{ media_players[trigger.event.data.device_id] }}"
        media_content_id: "{{ tags[trigger.event.data.tag_id].media_content_id }}"
        media_content_type: "{{ tags[trigger.event.data.tag_id].media_content_type }}"
    - service: media_player.play_media
      data:
        entity_id: "{{ media_player_entity_id }}"
        media_content_id: "{{ media_content_id }}"
        media_content_type: "{{ media_content_type }}"
    - delay: 2 # timeout before we allow processing next scan

![](upload://5U4LcVCEflaSsYbvAClx2FESH8d.jpeg) Printed NFC cards. Learn how to make them

Time to get scanning!

With these new features, you will be able to do a lot of cool things. Get yourself some NFC tags or NFC cards to get going. Here is some inspiration:

  • NFC cards to play music
  • NFC stickers on books that play grandparents reading the book
  • NFC tags to activate scenes in the room
  • NFC cards to open recipes on screens in the kitchen
  • NFC tags to allow access to your home


This is a companion discussion topic for the original entry at https://www.home-assistant.io/blog/2020/09/15/home-assistant-tags/
20 Likes

Very interesting. I have a doorbird that uses NFC tags to get into the house, can i use this for HA as well? When I put it beside my phone it doesn’t seem to get picked up by the phone as many other NFC tags

:heart_eyes: Amazing!

I noticed nfc tags in the app a week or two ago and ordered some. Writing to one was a snap, and now I have one in my car to unlock my house door! It’s awesome. I may just have up make one of these jukeboxes!

3 Likes

Amazing work guys, I just ordered a Raspberry Pi 0 to build this but I like the ESPHome based solution much better! I’m trying to order @adonno ADONNO’s kit but the shop is not working for me, I can add things to the cart but when I get to checkout it is empty.

Wow ! It’s time to talk about what I’ve done 2 years ago !
It is a reader based on ESP32 with ESPhome. It allow to play music but there is 4 album by card.
Yes I detect the position of the card and I also add 4 capacitive buttons on the side of the card. 5 RGB led can indicate states.
For Example you can put a card for your child which can control 4 lights and have for each light 4 pre-select possibilities. Or on a card with music you can make skip/previous/stop/play . The functionality of the button is determined by the little pics directly on the card.

Mine is based on RC-522 : a very cheap RFID reader which is compatible with ESPhome thanks to this code from HausnerR

6 Likes

The NFC jukebox is supposed to be used with an NFC tag/card, right? It means that when you enter a room for instance, you put a tag close to the reader to start a music which is associated to this particular room and this particular tag, right?

Doorbird uses RFID, not NFC. So it will not work with a smartphone like that.

That is really interesting. I’d love to know more about the hardware side of that!

Just ordered parts I didn’t already have on hand. Amazon should have them all here the day after tomorrow. Woot!

Cool. This should be able to let me use the same rfid keys to the building to unlock the door to my apartment. Without too much hassle. Shop is currently not working for me though.

Same here shop doesn’t work wanted to order one :muscle:

@thundergreen Sorry should be fixed now we build a new store https://adonno-crafts.myshopify.com/

2 Likes

@ATWindsor can confirm i have Doorbird as well and that won’t work. We considered RFID as well but the dilemma with RFID is, it won’t work with phones. So we went for NFC
FYI @Rocklobster

Ordered the plug and play kit! Any pictures of the black version of the tag?

Do u ship to france ?

Just ordered a diy kit to Australia. Look forward to playing with this new part of HA.

Can we use android NFC card emulation to make authenticated requests?

E.g. I scan my phone on the nfc reader, and the home-assistant app emulates a specific card (with an auth token) to trigger secure events. Like unlocking the doors.

1 Like

I am honored and flattered that my RFID Jukebox would inspire you! Thank you for creating and building this natively into Home Assistant.

I can’t wait to set this up!

2 Likes

This is superb! Now, does anyone know what’s the cheapest printer that can print PVC cards like these? :smiley:

Here you are

@thundergreen I do send to France