Node-Red or Automation

Hi all,
Ive been using HA for a few months now with various devices and automations etc. I have recently been playing with Node-Red but cant decide if and how to use it.

I see the advantages of it being self documenting and easier to create and modify flows (over automations) once I’ve got to grips with it some more. Oh and lets not forget them annoying reboots when testing new automations and making tweaks (yes I use packages)

However I have that little voice in my head telling me I should hold back because if HA updates and the integration gets broke how long before its fixed. Am i overthinking this?

Just wondering how other people use it? if you move all automations across or have some way of deciding if you create Node-Red flow or HA automation have decided not to and for what reasons?

I recently switched all my automations over to Node-Red (from a yaml/Appdaemon combo setup) and couldn’t be happier. (Once I got over the learning curve)

Of course it would be best to use the built-in yaml/automation system for the reasons you mentioned, but right now, the built-in yaml/automation just lacks features that more complex automations require. You could end up with multiple Scripts/Automations/Etc… trying to do one complex automation that you could do in a single, simple, Node-Red flow or Appdaemon app.

Then you have debugging/tweaking/rebooting issues with using the built-in yaml/automation system which makes it a PITA…

As far as your concerns about breaking changes, right now Node-Red & Appdaemon are popular enough that fixes generally happen quickly, both use the HA API and I don’t think either have ever had the integration get broken, so unless the HA API changes, which doesn’t happen often, if at all, you’re pretty safe.

You also always run the same risks of the built-in yaml/automation system being updated and having breaking changes which happens way more often then API changes…

Basically, if you have simple automations, it’s probably better to stick with the built-in yaml/automation system.

If you use more complex automations, the benefits, power, and simplicity of Appdaemon and/or Node-Red far outweigh any concerns about the future, at least for the foreseeable future.

P.S. The debugging tools in Node-Red are a game changer… :slight_smile:

Makes sense thanks.
I find most automations start off simple then evolve like the one i’m working on at the moment. Amazon dash button as a doorbell, which started off nice and simple TTS to my google homes. Now it checks my house mode, flashes the lights and if we are out uses join to ring our phones.
Next will be sending images from cameras, when i get cameras

That’s one of the main reasons I switched over all my automations to Node-Red, as the number of my connected devices expand, adding extra functionality to existing automations/flows is a breeze… The same can’t be said for the built-in yaml/automation system. :wink:

yeah very true.
I’ve just thought I might as well get the doorbell to pause the TV as well if its on.
Ill move my doorbell into Node-Red seems like it could be a good one to get started with.

There is a learning curve with node-red but it is worth it. It is so easy to build up flows over time and debug them.

Yeah i moved my doorbell over today with all the extra bits on it and its working very well

Bit of an update anyone else has seen this post or trips over it.

I’ve had success in moving a lot of automations over to node red and its so much easier to see whats going on and debug especially for things like the entertainment system with TV, Xbox, Harmony, Surround, Chromecast to fill in the Harmony gaps.

Running Hassio im finding it no good for remote light switches (Physical and PIR’s) with a mix of Xiaomi and sonoff’s due to delays.
Some times its almost instant and other times there’s a delay of upto 4-5 seconds compared to automations, which are consistently instant.

It seems searching the forums some others are having the same issues but no one appears to have come up with a solution as of yet. So for me its time critical in HA and those i don’t mind the delay in NR for now.

ignore most my last post i’ve just got to the bottom of the slowness issue.

see here Node red responsetime

Will I be able to see the automation in HA then? I’d like to be able to enable/disable my automation using the HomeKit App. And currently I an do so with my automations.
Would be great if there’s a way to enable/disable automations done in node-red that way :slight_smile:

What I do is a bit cumbersome, but have a dummy mqqt switch in HA that sets the state of the trigger in NR if you get what I mean.

I moved everything over to NR about 6 months ago, and now the have over 30 different automations in it from the simple to quite complex, all sending out notifications etc. This switch you can expose to HomeKit or even Alexa to turn off and on the automations

Sounds great. So I guess you did something like?

  persistent: true

I use input_booleans in HA for various things: phone notifications, TTS, auto-climate, circadian light colors, etc. Basically master “house option” toggles.

The flows in Node-Red check the state of those input_booleans before running the automation.

Then I can either toggle them in HA interface or via Alexa.

I’ve been using appdaemon for years because I could never do what I wanted with yaml. I recently gave NR another shot after having bad luck about a year ago and in two days made the switch and I’m about 80% from moving over all my automations to NR. Assuming it stays stable It’s much easier/fast to make automations.

This mudroom automation in NR was four times larger and complicated in appdaemon. My watchdog timers I could never get working right, took about an hour to get them working perfectly in NR.

1 Like

I also have been developing a lot in NR lately. I only left the automations that I already had working on yaml (mostly because of the huge number of hours invested).
But I confess that ALL the automations that I have needed in the last months are done with NR, specially since the addon is so stable.

What do you use the functions for? Do you modify the payloads? Could you give some detailed examples?

Most of them are conditions and changing the output. For example, the Morning routine one in the middle does this

let hass = global.get("homeassistant");
let mode = hass.homeAssistant.states["input_select.home_mode"].state

// Only continue if the mode is right
if (mode === "Home") {
    msg.payload = "Good Morning"
    return msg;

This could be done with different nodes I just find it easier to just use a function node instead.

The pantry door one at the top just changes the payload so I can pass it directly to the HA service call. When the door is opened it triggers “on” which I just add to “turn” and pass it in.

return {payload: { service: "turn_" + msg.payload }};


Very clever, thank you!

How do you populate hass.homeAssistant.states[“input_select.home_mode”].state ?

I see, it’s always there. Nice :slight_smile: