NFC Tags without clicks

What do you mean “click on the phone”? The only requirements on NFC with phones that I know of is that they must be unlocked first – otherwise it’d be a gaping security issue.

When I scan it just shows a notification and then you click the notification before the scan is actually trigged in HA.

1 Like

Which iPhone do you have? Background tag reading (no notification) is only supported on XS / XR / 11 / 11 Pro

I have an 11pro. Do i need to enable that somewhere?

1 Like

I don’t have an iPhone, I’m just google searching answers for you.

2 Likes

Looks like an Apple limitation:

On iPhones that support background tag reading, the system scans for and reads NFC data without requiring users to scan tags using an app. The system displays a pop-up notification each time it reads a new tag. After the user taps the notification, the system delivers the tag data to the appropriate app. If the iPhone is locked, the system prompts the user to unlock the phone before providing the tag data to the app.

1 Like

If you use the built in shortcuts app you can scan a tag and run an automation - eg toggle a HomeKit light or fan if you have HomeKit working in HA. During the automation creation there is an option to turn off “ask before running” so that the automation will run and just provide a shortcut notification at the top of the screen that the tag has been scanned.

There are videos on this on YouTube showing how to implement this.

3 Likes

So basically don’t use HA for the tags use shortcuts and have shortcuts do the call to HA?

You need to have HomeKit working to do this as that is how I use shortcuts to control my lights and switches. I am using the built in HomeKit bridge in HA.

Hi,
i have the exact same issue. Also working with a iPhone 11 Pro Max.
But for me its no solution with HomeKit, because i can’t get all my devices working with HomeKit (e.g. my Xiaomi Roborock S6). So i need to start my tag-automations with HA. Is there somehow a way to get the automations run without clicking the notification after scanning a nfc-tag?

What about using an Input Boolean in Homekit to start or stop your Xiaomi Roborock S6. They act just like a switch and you can create an automation that reacts whether the boolean is turned on/off. They can be added to Homekit so that the Shortcuts App can control then using an NFC Tag.

Yes, I ended up using shortcuts and webhooks - more details in my latest blog post:

Activating Home Automations using NFC tags on iOS

The HomeKit bridge is an interesting idea, though; might have to try that too.

2 Likes

Great blog post, @quentinsf! I was able to get my tag automation setup so I can scan a tag without having to interact with the phone to make it happen :slight_smile:

There’s a comment/question on your blog post that I tried to figure out but was unable to succeed at. It suggests using the “app” action and sending an event to the Home Assistant app. When I tried this I wasn’t sure what to put in Siri Shortcuts but I tried a few things and got errors. Perhaps you could answer this question there.
Thanks again for such a clear and useful post!

It’s a security thing so random tags cant get your phone to do things that you don’t know about until it’s too late.

Shortcuts is the only way to do it without a prompt, the easiest way is by making it fire an event (Web-hooks is unnecessary as you can run events via the app from shortcuts and all you need to do is give the correct event name & can limit which user(s) can run the event)

I personally have done both the Companion App & shortcuts methods (and just added the event as the automation trigger) so others can trigger the events via their phones but mine is done in the background. It does mean I have the “Open in Home Assistant” notification which is a little annoying but I can live with it.

Hello everyone,

I figured out a way to trigger automation with NFC tag without unlocking your iPhone or clicking on notification. It’s quite simple, you don’t even need to register NFC tag in HA. All you need to do(this is for iOS users only) is to go to shortcuts on your iPhone and set a new automation then find NFC, click on it, then just scan your NFC tag(give it a name) then Add an Action, from there select fire event then a just give you event a name(anything you want just don’t use spacing). When you finish that press next then turn off “Ask Before Running” then you are all done with your iPhone set up. Now go to your HA and create new automation and under trigger select “Event” then in “event type” write same event name that you put in your shortcut automation on your iPhone. When you are done with that, scroll down and just simply add an condition(optional) and action(mandatory) for that trigger and you are all set.
I really hope that this helped someone and that I contributed to this community at least a little bit cause this community contributed A LOT to my Home Assistant setup.

18 Likes

Thanks @Spaka
It worked like a charm. In my case is a bit slow to execute but I guess it is probably because I am using an older iPhone?

Thanks @Spaka - works perfectly.

Anyone here know of this same workflow for Android?

2 Likes

I don’t have an Android but I’ve heard the app is called tasker. Not sure if it can do what you wsnt

Ah yes, I know tasker. Haven’t used that in awhile, hoping I don’t have to load it on all phones vs something native to either HA, the Android app, or Android (like Shortcuts)

Thank you for quick response.