Just got a pack of NFC tags to experiment with, and I am curious exactly what is written to the tags and how that will affect their performance with visiting devices (I don’t have any spare NFC-capable devices to test with).
Is a tag written with an actual API command so that virtually any device that scans it can issue the command to my server, or is the command on the tag specific to the OpenHab Android App in a way that would require a visiting device to have the app installed and linked to my account for the tag to function?
That’s a really good question. I’ll be watching this thread. @mueller-ma, is there a simple answer to this question?
If we assume that:
the actual command is written to the NFC tag
the command’s URL is using the local connection as configured in the Android app
reading/reacting to the NFC tag does not require the openHAB Android app to be installed to work
The way to protect just any old device from being able to use the tag would be to set up a guest network for guests to log into. From this guest network they cannot see your OH so try as they might, they won’t be able to see you OH instance to issue the command.
If we change that middle assumption to using the remote URL, then there will be authentication required to log in to that remote URL, authentication information you can withhold from your guests.
If you allow your guests access to your main wifi network, than you must already trust them enough to where their ability to control things though an NFC tag would be no big deal.
Thank you for confirming. I was able to confirm by scanning the tag in the NFC Tools app for Android and extracting the Openhab:// URI directing to the app.
On further investigation, it doesn’t look like Openhab can natively change the state of an object based on a URL alone, unless it is issued with a curl/PUSH command through the REST API, and curl doesn’t seem to be a function that just any Android device could parse natively. (I’m a bit of a novice, so I could be wrong.)
I may have to look at alternative options for triggering commands via NFC, such as writing the tag with an IFTTT webhook if I want to make the function more universal.