[HOW TO] Prepare and use NFC stickers to start a flow

NFC stickers are cheap and can replace for instance a button. This tutorial demonstrates how I was able to write a string to a NFC sticker, read it with my android phone, and start a flow in Homey Pro.

This is my setup:
-I have an android phone/Google Pixel 6
-I have “Use NFC” enabled on the phone
-I have NFC stickers (NTAG 213, type 2)
-I have Homey Pro 2019
-URL I’ll use: http://<Homey-LAN-IP>/api/manager/logic/webhook/<keyword>

UPDATE: After I created this how-to, I’ve since updated it here
…or just read on…

Step 1: Write something unique to the tag
Tags might come with an unique ID on them. In that case you can skip this step. My tags were empty, so I went through many NFC writers/readers but ended up with “MacroDroid” from ArloSoft. This app lets you write, read and automate the steps needed. Ok, start MacroDroid > Add macro > {give it a name eg ‘Livingroom_music’} > +Trigger (search for and select NFC) > Write tag

> {name the tag eg ‘livingroom_music’}…
image

Step 2: Automate what to do when tag is scanned
Well, MacroDroid bakes all this together, so let’s just continue from the steps above. You just wrote a string to the tag. Let’s add an action: +Action > Web interactions > HTTP request > {insert URL but replace <keyword> with ‘livingroom_music’ (make sure it’s a GET request)}
image

Lastly, open the “…” menu and select “Save changes”. That’s it for the tag!

Step 3: In Homey Pro, set up the listener flow

That’s it!
The ‘Cast text to Google’ gets old fast, but is fine for verbal debugging in the beginning. I removed it after this was made :slight_smile: :+1:

This is a poor man’s implementation of this dream

PROS: This works, Only I can use the tag for this (everyone else need to associate the tag ‘livingroom_music’ with their own actions)
CONS: Flipside of the PRO: If you want to share the action with everyone, it might work to store the webhook URL in the tag. Haven’t tried.

Update: I was lying: I have tried it. See here

2 Likes

Didn’t think of this idea! This should work,
but:
-After hitting the nfc popup which presents the webhook , it probably opens a browser screen with ‘OK’, but it’ll start the flow. An opening browser each time can be annoying to certain people
-Make sure to convince people it is safe to hit the link :grin:

Nothing pops up on my phone…

Do you test with a ‘clean’ phone, or with one which triggers Macrodroid?

So, this solution needs MacroDroid to be installed to work. If someone can:

  1. Name another NFC reader that can send a GET HTTP request on LAN or to webhook.homey.app
  2. Name another NFC writer that can write the URL on to the NFC tag so that it fires a GET request when scanned…

…I would be very interested in that.

No, did I say that? You don’t need Macrodriod, when you program the NFC with a webhook.
I tried to say when you want to use this on general phones, like ‘everyone’ has (and no Macrodroid with your NFC macro’s), those people probably will find a browser popping up reporting “OK” when opening the webhook through the NFC tag.
That can be annoying.
That’s all.
And if you don’t care about the browser popups, I don’t care.

It’s true on YOUR phone with macrodroid and the NFC macro’s, no browser gets opened on-screen by macrodroid.

1 Like

You might be right, but this is not the way I understand it. They way I see it, the tag only contains the string “livingroom_music”. The connection to fire a GET request is in MacroDroid in the macro named “Livingroom_music” (with a capitol “L” (why didn’t I call i “livingroom_music_macro” just to be clearer :- )).

But we talked about PROS and CONS of writing URLs VS. just and ID/string. Inside my house, it would make sense to write the URL and hoping that each phone is capable of scanning the tag and firing it off… Outside the house/in public it would not be smart to embed and URL to trigger functionality inside your house…

When I find a way to write the URL to the tag, I will try to remove MacroDroid and test… untill then, I’m too dependent on firing up the speakers every time I enter a room the way it currently works :- )

I was in a trial period with MacroDroid (was unaware of that at the time) and has since uninstalled it. Am currently using NFC tools to write the URL to the NFC tags.

In short I write the following URL by selecting Write > URL / URI >
image
…using: http://<Homey-LAN-IP>/api/manager/logic/webhook/<kword>

Remember: Substitute Homey-LAN-IP with Homey’s IP on your LAN and kword/keyword with the ones you want to look out for in flows. E.g.: livingroom_music

Homey: Look out for the keyword like this:
image

Pro: Everyone can read and fire off the http requests
Con: As others alude to, a new browser window with the return value “ok” pops up every time a tag is read. A small price to pay, but if anyone knows of a way to circumvent this, I want to know!!! :+1:

Tested & worx on Android. Currently testing reading with IPhone…