Seamless Home Assistant NFC Automations on iPhone

Published by Christian Mohn · Read in about 3 min (529 words)

Home Assistant has the ability to read and write NFC tags via the Companion App but using this on an iPhone is a bit cumbersome as Apple doesn’t allow that apps read NFC tags and do an action without a confirmation from the user. This default setting makes sense, as I don’t want random NFC’s triggering events on my phone, but there is no way of overriding this behaviour even for known tags — which sometimes defeats the purpose of having NFC tags automate actions and events in Home Assistant.

How to Create Seamless NFC Home Assistant Automations on an iPhone #

Info

It also seems that NFC tags written by Home Assistant Companion App includes information about app itself, these tags will always trigger a confirmation.

Luckily there is a way to work around this, by using the iOS Shortcuts App. Simply put, iOS Shortcuts can trigger an action in Home Assistant just by scanning an NFC tag, as long as you have the Companion App installed.

Creating a generic NFC tag with Simply NFC #

In order to do this NFC Tags needs to be written outside of Home Assistant, I have used Simply NFC with good results. Shortcuts only needs to be able to read a tag id and that’s it, and Simply NFC makes it to do so. The only requirement for writing to a tag, is to add a record to it — and this can be anything, for instance just a text string

Simply NFC

Once that’s done, write it to the NFC.

Creating an iOS Shortcut to Trigger HA Events #

Once you have a generic NFC written, create an iOS shortcut that triggers and action (or something else) within Home Assistant.

Open up Shortcuts on the iPhone. Click on the + in the top right corner, and scroll down to NFC and click it.

iOS Shotcuts

Select Run Immediately, if you don’t want to have to confirm the action when the NFC tag is scanned.

Click on Scan and scan the NFC tag, and give it a name in the Name This Tag window that pops up.

iOS Shotcuts

Click on Next in the top right corner and select New Blank Automation on the next screen.

iOS Shotcuts

Scroll down to find Home Assistant and look for your preferred action. In this example I am just controlling a light, so I’ve chosen Control Light and selected a light for the automation. I’ve also set it to Toggle so I can use the same tag to turn the light on or off.

iOS Shotcuts

Click on Done and that’s it. The next time your iPhone reads the NFC tag, the chosen action will trigger without any confirmation required.

Tip

You could also have Shotcuts trigger a web hook in Home Assistant, but that’s a less secure way of triggering actions as it doesn’t require any form of authentication in Home Assistant unlike doing it through the companion app that requires authentication in the app itself.

The same method can be used to trigger more advanced scenarios in Home Assistant, like scenes or run actions. It can also be used to trigger anything that the Shortcuts app can automate, without involving Home Assistant at all.

Post last updated on January 2, 2025: Update NFC-tags-iPhone-Home-Assistant.md

About

vNinja.net is the online hub of Christian Mohn and Stine Elise Larsen.

The site primarily focuses on IT architecture and data center technologies, with a strong emphasis on virtualization and related topics.
While the main content revolves around these areas, you'll also find a range of other subjects covered from time to time, reflecting the interests of authors.

Sponsors