Using NFC tag as override for other automations


I have the light automations setup in the photo attached.

I want to be able to use an NFC tag to disable the automations in this flow so I can set a scene for all the lights in my room so even if I walk past a sensor it will keep its current state that I have set in the scene. Then use the same or a different NFC tag to enable the automations again. I am new to Node Red and am having issues finding a solution for this.

Appreciate any help

Hi @melch98 Welcome to Forums!

I may sound BIAS here - but do you happen to use an iOS device?
If so - the shortcuts application can kick off a web request when it comes into contact with an NFC tag.

you can use this ability to send Node RED a request.

1 Like

Hi Marcus, thanks for the reply.

I currently have an android phone.

I was looking to use the toggle node to take an input from the nfc tag then use that state as a condition

This is what you would need to do.

Find an application on the Android platform, that is capable of listening for NFC tags.
This application, should allow you to trigger things to happen on such android device.

Trigger what exactly?
Send a HTTP request to Node RED.

Node RED has the HTTP IN node, and you do what you need to, when the HTTP request comes in.

On the iOS platform - we have a shortcuts app, that allows to automate things given a trigger (such as coming into contact with an associated tag) one can send a HTTP request when this triggers.

I don't know what is available for Android in that respect - so hopefully someone can chip in.

in nut shell

  • Set up a HTTP IN node to do things when a request is made
  • Have your android device send this request, when it detects the NFC

If this.

Can trigger a http request, when it detects an NFC - it should get you going (and is 95% of the way there)

I am able to trigger the nfc tag for this automation and am able to output true on false with the toggle node but am not sure how to use this as an override in my automations

Sky's the Limit!

Maybe store the output from the toggle node in a global variable (you can do this with a change node)

To make use of this variable...
Put a switch node before any of your actions - so the switch node will only allow a message to pass if the variable is of a certain value

I am having some issues using the toggle as it only takes in a msg.payload

Not sure how I can toggle with my own variable and link with the automation.

Again thanks for your help

You don't have to send anything yourself to the toggle node - you're already doing that from your tag output (at least according to your screenshot)

What I mean is, store the "true" / "false" output from it into a variable, and use that variable later to decide if an automation should occur using a switch node

See rudimentary example below.

[{"id":"2825c99144e4da06","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"331994428e895cea","type":"inject","z":"2825c99144e4da06","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":150,"y":340,"wires":[["a87240968ef305bc"]]},{"id":"5acf9bb884275c06","type":"inject","z":"2825c99144e4da06","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":150,"y":440,"wires":[["a87240968ef305bc"]]},{"id":"a87240968ef305bc","type":"change","z":"2825c99144e4da06","name":"Set Variable","rules":[{"t":"set","p":"ShouldAutomate","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":380,"wires":[[]]},{"id":"cfa56a42589a2b15","type":"inject","z":"2825c99144e4da06","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":160,"wires":[["50f88c6c50658a82"]]},{"id":"d0dec19452e383bb","type":"debug","z":"2825c99144e4da06","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":580,"y":160,"wires":[]},{"id":"50f88c6c50658a82","type":"switch","z":"2825c99144e4da06","name":"","property":"ShouldAutomate","propertyType":"global","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":160,"wires":[["d0dec19452e383bb"]]},{"id":"15620a9fd398be24","type":"comment","z":"2825c99144e4da06","name":"This emulates your toggle","info":"","x":190,"y":300,"wires":[]},{"id":"1f632c63741d8b09","type":"comment","z":"2825c99144e4da06","name":"Will only pass if ShouldAutomate = true","info":"","x":390,"y":120,"wires":[]}]

Ok thanks for that Marcus I got it all working thanks a bunch

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.