NFC and Home Assistant

Photo by Brett Jordan on Unsplash

I have been using Home Assistant from the very beginning. I started the home automation journey with a Raspberry Pi 3 and later ran my instance on an Intel NUC.
It is a never-ending journey, though. I continue to add new hardware when it comes in, update my automations, tweak the UI, and so on.
I extensively use the Companion App on my iPhone and Apple Watch. It works great. I have a list of quick actions on the home page that helps me automate some things in my house. Activate the “movie lighting” in my living room, execute the “Goodnight” script, and so on.
That’s quite efficient, even if not as seamless as I would like.
This is where NFC comes to help.
The Home Assistant companion help can write NFC Tags that are Home Assistant friendly. When you read an NFC tag, you can trigger an event on the backend and run the actions associated with the specified tags.
The iOS security layer will ask you for a confirmation before sending the event to the Home Assistant backend.
From a user experience point of view, this works with just a few clicks less than finding the equivalent quick action on the Companion App home page.
I don’t like it.
I found a way to read an NFC tag on my iPhone and run an action on Home Assistant without any confirmation on my side. The only caveat is that the iPhone must be active, even if only in the lock screen state.
Here is what you need to make it work:

  • NFC Tags: there are so many options out there. You need an NFC tag that you can write at least once. I have purchased 25 Timeskey NFC tags for 16.00 Euros (0.68 Euros per tag).
  • You need an App on your iPhone to write the tag. No, you can’t use the Companion App to do this because you need to write something different from what the Companion App writes on the tag. I use NFC Tools, which is free for what I need.
    That’s it.
    Here are the steps you need to follow in order to make it work:
  • Write some text on the tag using the NFC Tools App. For example, let’s write the text “Studio_1” meaning that this is the NFC tag number 1 in my studio.
  • Launch the Shortcut App on your phone, select the Automations tab and tap on the “+” sign in the upper right corner in order to add an automation.
    • Select Create Personal Automation
    • Tap on the NFC option and scan the NFC Tag you just wrote.
    • Add an action to send Home Assistant an event. Be careful not to use any space in the name you will assign to the filed with default data “shortcut_event”. Select your Home Assistant server in the data section of the Action. I usually name that field with same data I wrote on the NFC Tag.
    • Go back to the previous screen and uncheck the “Ask before running” if it is toggled.
  • Go to your Home Assistant automations page and add a new automation.
    • Select ‘event’ as a trigger.
    • Add the name of the shortcut event you created in the Shortcut app on your phone
    • Leave the Event Data field empty.
    • Now add the conditions and actions you need for your automation.

You don’t need anything else.

0 0 votes
Article Rating
Notify of

0 Commenti
Inline Feedbacks
View all comments