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
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.
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.
Click on Next in the top right corner and select New Blank Automation on the next screen.
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.
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.
Related Posts
- Fun and Games With WLED, ESP32, IKEA UPPLYST and Home Assistant — Published
- Casting Home Assistant Dashboards to Google Nest Hub 2nd Gen — Published
- Combined Pi-Hole Statistics in Home Assistant — Published
- How I Use Home Assistant: Part 4 — Automatically Enable and Disable Sonos Night Mode with Node-RED — Published
- How I Use Home Assistant: Part 3 — Morning Coffee — Published