Node-Red flow examples

Hi folks,
So given I’ve come across numerous people in a similar position starting out with Node-Red I thought i’d start a forum so others can scroll through for inspiration. Lets try a simple format of a picture of the flow, brief description and then the code for it?

6 x Nest Protects - will send iOS for Warning and Danger based on location of sensor.


Thanks to @Kermit for the regex assist (and websocket Node-Red contrib palette too)!


here is a simple node red flow for a sonoff switch (tasmota) using node red , big timer and a HA state node. In HA there’s a input select created in HA ( in config.yaml) to choose one of 3 states thats pushed to big timer

HA statenode in node red is set up like this

and finally config.yaml input select set up

flow is here at pastbin


Next up - a sunrise alarm clock.
I’ve the first part of this set up for a while - as I wanted a variable alarm clock, that then can invoke something in HA. Using Hue White Ambiance Bulbs to start the day a little more softly than my iphone alarm!

I set my alarm in the evening by invoking Alexa [“Alexa set alarm for 6 am”]
Then when the alarm goes off, IFTTT sends a webhook to turn input_boolean.alarm_clock to on.

Now the input is set up, to the flow (and bare in mind if you snooze alexa, in 10 minutes time the process repeats, so I wanted to ensure I prevented the brightness restarting.

I’m sure smarter people will find a simpler way, but here is mine:

Here is the flow:


Ok - GoDaddy and DDNS

I use a wildcard certificate - and a bunch of subdomains to connect to my various web services all running on my Synology NAS.
(note the Synology NAS does actually use NGINX but its built in, so shows up as a reverse proxy / application portal which is very handy).

I have an ISP that doesnt provide a Static IP (although for the most part pretty solid if nothing changes).
Godaddy doesnt support DDNS, but DOES have an API.

The approximate plan.

Node-Red asks for both my external local IP AND the current IP of my GoDaddy A record.
If they differ run a HA shell_command to update the various A records.

First up the flow.
Thanks to Paul-Reed for inspiration
I’m sure you can also write an nslookup but this was too easy

The sequence runs every 5 minutes.
Start by using a command at whatsmyipaddress then checks its a properly formatted IP = msg.local.

Then set URL msg.payload as, sends to the dns node. moves the message to

Finally combined and compared. If different run script.
[You could do this by storing your IP in a variable and if it changes then run script also]

Sequence here (be sure to change

The script

So thanks to
First off I used the Linux release binary here:
and copied that to my HA config folder.

Then you need to create a json file like this one called .godaddy-dns.jsonand save it in the same location as the command:

Finally invoke the command from HA ./dns-godaddy-linux --config .godaddy-dns.json

also thanks yet again to @Kermit for continual dev work on node-red-contrib-home-assistant-websocket:

and constant help on NR discord!

Do you push all three states to big timer or only if it is set to Auto and then let big timer control it? Also you could send on and then let big time control it or turn it off.

Thanks for sharing I am just getting started with node-red and love to see examples.

i generally let big timer do its thing eg auto is “on timer” via big timer, i set the flows up for external security lights, but what i found was there was the odd occasion , where i needed a light off for the evening, or on for a few hours longer than set on the timer, hence using an input select so it had three choices in the drop down from the UI

big timer afaik only accepts 3 inputs , on off and auto(default) …im sure i could trigger more with it and also using the same input select to push a command to something else, eg switch porch light on , and turn pond pump on.

If someone is willing to share, I would really like to see an example of a simple node-red configuration that would allow me to use Alexa to turn on a switch. In my case, I would like to issue a voice command to turn on my coffee maker (wemo Mr. Coffee). Also a couple of questions. The Alexa Local node does not require access to the internet correct? And if I have more than 1 Alexas, how do I select from which one the command should be available? This could be useful later on when I want to turn the TV on in different rooms.

1 Like

I have played around with the Alexa Local nodes a little. Check out the Hook up youtube channel and watch

Mastering Node-RED: Custom Alexa Commands + Node-RED Dashboard for a tutorial

Basically you would drop in an Alexa Local Node and name it what you want to ask Alexa send that out to a switch node for on or off and the send those out to a call service to turn on or off the switch

After you create the Alexa Local node and deploy you can ask Alexa to discover new devices and it should find your new device called Mister coffee or whatever you chose. It is a hue emulation so say " Alexa Turn on or Turn Off Mister Coffee".

Should do the trick.

As far as picking the specific Echo device I am not sure that is possible using this method…maybe someone else can chime in with alternatives.


The association of devices with a specific echo is done in the Amazon Alexa app using device groups.
You can put a bunch of lights and and echo all in the same group, then when you say “Alexa - lights on” it knows the lights you mean from the group.
TV is a bit more difficult as the device type ‘TV’ needs to be declared to Alexa. Hue emulation (as used by the Alexa Local node) can only declare simple types like lights (and maybe a switch).
To do TV you need to use the updated version of the alexa-smart-home-v3 node type which is a fork of the official alexa-smart-home (by Ben Hardill) node type. As it’s a fork it’s not in the official Node-red libraries, nor does it have an official Alexa skill (you have to request the dev app from coldfire84).
It’s not simple, but you will then, eventually, be able to say “Alexa - turn on TV” and the TV associated with the echo will turn on.
Here’s the link for alexa-smart-home-v3. Good luck!

1 Like

@jaburges Hi! I am curious about how you solved the message part for iOS notify. The Hastebin link seemed empty. Appreciate if you would post it again. I am thinking of combining jinja template sensor for last motion, camera and notify.

Maybe someone can help…
I want my lights start flashing when my alarm triggers. I’ve made two scenes.
“Alarmlights on” and “alarmlights off” and put a delay between them so it will loop.
I have no idea how to stop the loop.

I have to hold all states when i disarm the alarm and put this after “alarmlights on”, but i don’t no if this possible and how.

Thanks for the help!


you could make an input boolea ( ) triggered by the alarm. then you put a node in the lopp that check the status of the boolean? :slight_smile:


How do you tell what the message is going to be? I love this example, but I would love to include a notification when one of my devices is offline… I know I can use the “online” binary sensor, but how do you parse out the message as you have done above? How would I know ahead of time what I should expect message-wise?

After your off node place an Current State node that checks the current state of your alarm. If the alarm is still activated loop back to your delay node. If not, exit the loop.

The input Boolean dit the job. I turn the input boolean on when the alarm is triggered so the loop will start. When is disarm my alarm the input boolean is going to off so the loop stops.

Maybe someone can help with another problem.
I want to turn on my lights in the evening (scene not home) when I leave the home or (scene home) when I’m coming home. The lights need to go on with an offset based on the sun -15.
I have it working just based on the sun trigger below and above horizon, but i don’t know which node I can use for an offset.

1 Like

Sometimes it’s so simple :see_no_evil:


Hello everyone,
I’m new in home assistant and I’m trying to set my first flow in node red and this should be very easy but I’m a noob at this
my idea is to open my blinds during day when I’m home and close when I leave or after sunset. I have a tubular motor with sonoff dual tasmotized.

Thanks for the help

Hello again after a LOT of trial and error I managed to get my first flow working, I’m open to sugestions on how to improve it but I belive its working,
Hope it can help inexperienced guys like me,

The goal is to open my roller shutter when I arrive home if its between 8AM or 8PM, and close it if I leave home, should also open it at 8AM if anyone is home, and close it at 8PM.

[{"id":"6e7c66f8.eb4cf8","type":"api-call-service","z":"c4466fff.4bb8","name":"close roller shutter","server":"95304ac6.bfca28","service_domain":"switch","service":"turn_on","data":"{\"entity_id\":\"switch.descer_estores\"}","mergecontext":"","output_location":"","output_location_type":"none","x":1150,"y":320,"wires":[[]]},{"id":"95304ac6.bfca28","type":"server","z":"","name":"Home Assistant"}]

Don’t know why, but in the node to get the state home or away for the automation in the morning/night it only work when I placed “halt if home” and did not work at all if “halt if not home” why is that?

it may be easier to use ‘eztimer’ palette as you can easily set on/off state of the node based on time (or sunset etc).
then a simpler flow is the eztimer node on then continue to shut the roller?