[SOLVED] Will NFC Tags written from Openhab for Android work with visiting devices

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.


Last time I looked at the handling, this was as follows:

  • user writes tag
  • tag stores only an URI
  • when scanned, the URI is passed to the app
  • the app handles the URI. Authorisation f.e. is configured in the app.

A device in your network and with the app installed, it will simply push the command encoded in the URI to the configured installation in the app.


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.

Yes, there is a simple answer: You need the openHAB client installed and configured (at least url and authentication). If so, you can use any tag written on one device on a different device.

While you don’t need the app to read a tag, other apps won’t send a command to the server.

The content of a tag is openhab://?i=item&s=state. It may also include the item label and state mapping, e.g. “Scene TV” => 2. The latter two are only used to show more readable UI messages.