Background NFC tag reading

Trying to wrap my head around background tag reading on iOS, and it seems like we have two options:
The first is to use universal links. When scanning the tag, a pop-up will show, and clicking it will perform the relevant action.
The second is through the Shortcuts app. From what I understand, this will be “true background” (i.e. no pop-up), but the downside is a need to manually program every device and tag combination (and it’s also unclear if this works for a single tag and more than one device).

Is there any way to get the best of both worlds? True background scanning without having to manually programs n devices times m tags?

Anyone? Any thoughts?

You may be interested in this change/addition to the iOS app.

1 Like

Thanks. This is the universal link approach (but with great improvements that make it easier to use). It still, however, requires confirmation.

Unfortunately there is no way to get background NFC reading outside of the universal link approach. Apple documents their limitations here:

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.

Right, but the shortcuts apps is a special case that doesn’t require confirmation, right?

Correct. I do not believe there is any way to make Shortcuts.app handle NFC tags you haven’t specifically set up, either.

1 Like

@DudeShemesh

What about API call’s, is that something that we can write to a tag that goes direct to our instance and runs an action?

If you’re using the shortcuts app, you can do everything that it supports, like calling service, sending events, etc…
If you’re using the HA companion app approach, you can only send a specific type of event, but then you can use that event as a trigger for an automation that does anything you want.

This is my understanding of it, at least, I’m a regular user like you :slight_smile:

I understand why they’ve done it this way - any tag that can just perform tasks on your phone without you knowing what it’s for before doing it is a huge security issue & the shortcuts app provides a way to get around that and have tags run automatically because you set the app to do the tasks when you tap them.

All it really needs is for you to be able to mark NFC tags as “trusted” to run automatically i.e. if you read an NFC tag, it has this identifier and this data, you can run it without asking me.

The only real solution for now is to create the Home Assistant tag for “everyone” and when creating the automation add a Event trigger. Then set up the shortcuts app for you to fire the event. It will still give you the “Open In Home Assistant” notification (which is a little annoying) but Shortcuts will also fire and do it automatically. That way everyone can activate the NFC automation, but yours is done in the background.