- B590F284207F859E6F7B7CE82A0B6006

Thursday, September 10, 2020

NFC tags in Home Assistant the Android way

With the new update to 0.114 in Home Assistant there were alot of cool changes. One of the newest features I was anxious to test out and use for my home automations was NFC tags. Prior to this update, you had to use tasker and/or another app to get it to work. Well that is no more.

NFC (near field communication) is a wireless technology which allows for the transfer of data such as text or numbers between two NFC enabled devices. NFC tags, for example a sticker or a fob, contain small microchips with little antennas which can store a small amount of information for transfer to another NFC device, such as a mobile phone.

If you have updated mobile the app it supports reading and writing on NFC tags. According to my research, almost all mobile smart phones, within the last couple of years, can read NFC tags and almost all Android phones can read and and encode. Apple have enabled NFC tag scanning on the iPhone 7, 8 and X running iOS 11 or later with an App. The latest iPhone XS, XS Max, XR, 11, 11 Pro and SE models can scan NFC tags natively without requiring an additional App. So you have the ability to read then and even write them without you knowing.

So you are asking what the hell does this mean for home automation. Well prior to this update you had to use an other app to read the tags. Then had to use tasker to talk between your phone and home Assistant. Now if you have the HA mobile app...SCAN AWAY.

The first thing that I found was the little stickers/tags are cheap. You can buy 30 tags for $11. At that price there might be tags used for things all over the place. This opens up a lot of possibilities. Imagine having a script or Node Red flow that turns off everything at night or turns it all on again in the AM, with the tap of your phone. You don't have to say anything to a voice assistant anymore. Or push a button on a phone or tablet. Put your phone on a strategically placed tag somewhere on your nightstand, table or wherever, and boom your night routine/script is done.

The second thing I found, I have a Pixel 2/Android, I have to unlock my phone and have the screen on for it to read the tag.

This was the setup my Android phone in the Home Assistant App. Scroll down on the menu down to App Configuration

Then NFC Tags to setup a new tag

Then here you will either read or write your tag. You more that likely won't need to read your tag from here since you will just use your phone's nfc reader anyways.

In Home Assistant you have to set up an automation for it to do something.

It gives you the code you need for your automation. 

You can write you automation manually but I tried it with the UI and here is how I did it. I confirmed it worked.

You can see you need that device ID: from your phone and the tag ID also.

For my Pixel 2 I have to unlock my screen for it to read the tag. But once I touch the tag it opens up a window asking me to use the link for HA.

The automation is run and all is good!! It's not perfect...yet, but it's something cool to try.

The other thing I tested was my wife's phone. She also has the HA app installed. I touched her phone the the tag and nothing happened. So you have to have the app installed on the phone that you are using and add the tag in it also. So if someone came over and didn't have the HA app it won't work. So that's one level of security. So if the tag is tied to an automation through the mobile app it won't work.

I am working on getting a Node Red flow ready for this. But I thought that I would put this up since I found it to be something new and fun to try out.

The automation I made last night was to run a good night script where everything in my house turned off when I scanned the tag.


Hit me up on FACEBOOK and Twitter and give me a follow in this blog for new material all the time.

1 comment:

  1. Hi, NFC tags do work with iOS, you need to open the Shortcuts app which is an official Apple app that was made for iOS automations (if you don't have it just get it from the App Store). Smart Home Solver has a good video on this for more info: youtu.be/o9WHrX9cvXA