*The article below contains affiliate links. If you purchase an item after clicking on that link, I will receive a commission. Thank you!
What are NFC tags and why would you want them? To start, NFC stands for Near Field Communication. NFC is a protocol similar to an RFID tag in which you have a tag and a reader. You can use your phone as a a reader and the NFC tags can come in all shapes and sizes. NFC tags that I use are small circles (check them out here on Amazon) that you can hide easily, but there are also sticker types that you can stick easily to wherever you need them to be placed. You can place a tag next to your bed and when you wake up in the morning a quick scan can turn on your kitchen lights and start your coffee. Or maybe you can place one outside that turns on your outdoor speakers and starts playing your favorite playlist.
Prerequisites
The only things you will need to get started with NFC tags would be the tags themselves (or stickers or cards, I will just use the generic term tags) and a phone to read and write them. You can write tags with Home Assistant in the web browser but the process is a lot more complicated then writing them with your phone.
Writing a New NFC Tag
The process of writing a new tag in Home Assistant is basically only a few steps.
1. In the Settings tab of the mobile app, select “Tags”
2. Go to the bottom right corner and select +Add Tag.
3. Write the name of the new tag. This can be anything you want, so make sure to name it something that you will remember.
4. Select “Create and Write” in the bottom right corner of the screen.
5. The app will then prompt you to scan the tag. Place your phone over the physical tag.
6. Once it has been written you will get a success message on your app. And that’s it!
Reading your new NFC Tag
Now that you have the NFC tag written, you are able to read it. Starting with iPhone 6, Apple included NFC hardware. Holding your phone up to the newly written tag will open a prompt that you can press to acknowledge the tag.
This will send an event to Home Assistant saying that you scanned the NFC tag. The next step in this process is to create automations that will run when you scan that tag.
Creating an Automation with the New Tag
Before we write an automation, let’s take a look at what actually happens in Home Assistant when an NFC tag gets scanned.
The data that gets sent contains two pieces of information. The tag_id, which is the tag that was scanned, and the device_id which is the device that scanned the tag. When we set up automations, we can use conditions on these tags if we want to filter them a certain way. For instance, if you have a tag that plays music, you can have different music start depending on who’s phone scanned the tag. Now that we see what information is sent, we can create our automation.
Automation Trigger
We will start with a blank automation, so the first thing we need to do is name it.
Next we will look at the trigger for the automation. Home Assistant has a “Tag” trigger that we will use.
I am creating an tag that will play music outdoors, so I have named the tag “Outdoor Music” which is what I want to be the trigger for this automation.
Conditions
We will not have any conditions on this tag for now. But if you did want to filter based on which device scanned the tag, this is where you would place that condition.
Actions
For our actions, we will need to do three things. The first of those is to turn on the outdoor speakers. We can do that with a call service to turn the media player on.
Next we would like to set the volume of the media player. You can skip this if you always have the speaker volume set to the same level.
The third and final action to set for this NFC tag is to actually play the music. This will be a service call to play music. We use amazon music for our home audio, so that is what we will call.
Now we are set! Any time this nfc tag is scanned it will turn on the rear porch speakers, set the volume to 55%, and start playing 90’s country on Amazon Music. The power of Home Assistant and a quarter-sized NFC tag. You can follow this link to see the ones that I use.