Node Red VS yaml automations

I’ve just started using node red and I can already see some definite advantages to using it. I successfully converted several of my previous yaml automations to node red. But I had one issue that caused concern. I had a mis-configured node red flow that was arming my alarm system to away while we slept. Tracking it down in the logbook was a little tricky because it doesn’t look like node red reports to the logbook. I eventually found out what the issue was and fixed it but that raises the question.

For those of you that are using node red, are any of you using it exclusively for your automations?

While searching for a node red issues I found a thread with someone asking basically the same thing.

But if anyone wants to chime in with their opinion I’d still like to hear.

1 Like

I’ve moved all automations to node-red.

When deploying a new one, I usually insert a few notification nodes (Telegram mostly, in a specific channel) that help me track when the flow is triggered, what the output is and so on …

Once the flow is stable, I delete some or all the notifictations and move the remaining one to my main channel.
You can obtain pretty good results with that method in my opinion.

I have ZERO automations in Home Assistant. EVERYTHING is in Node-Red.

Because Node-Red and Home Assistant are 2 separate applications. You should be using the DEBUG node in Node-Red to troubleshoot Node-Red.

This is what I’ve been doing with the debug and insert nodes. So much better than yaml. But using notification nodes is a good idea too.

Blockquote
Because Node-Red and Home Assistant are 2 separate applications. You should be using the DEBUG node in Node-Red to troubleshoot Node-Red.

Debug is real time. What about history? The issue I had was the alarm was arming while I was asleep so I had to use the logbook to track down the issue. The log shows if an automation was run (in yaml) but it doesn’t show if a node red flow was run. From what I can tell there is no historical data in node red except the time stamps that appear under some of the nodes.

If you keep a page open to Node-Red, the debug logs are there, or you can log to system and monitor the system logs.

Because that’s a part of Home Assistant.

Because Node-Red is not a part of Home Assistant.

You can log everything to a database, or to the system log, or to a file. You can literally do anything you like.

I understand that it’s separate from HA and wasn’t expecting it to appear in the logs. Just stating the fact that I can’t look for node red data there like the HA automations. Thats a useful troubleshooting tool.

A database or the system log sounds promising. Do you mean collecting data in a database or system log that is external to HA or Node Red?

You can do whatever you like.

Log everything Node-Red does to a file, or to a database external to both

You can use the call-service node and write a custom logbook entry.

3 Likes

That is perfect! Then I can have the node red logs in the same log as HA. Nice!

That was me asking.

I now run all automations exclusively in Node-Red. This is now setup on a dedicated RPi (HASSIO Install)

I have all of my automations moved over to node red now. No troubles.

Do you have it running on a separate machine or as an add-on in home assistant? I’m currently using it as an add-on.

Congrats. Now you can enjoy tweaking them with no restarts.

I suppose that depends how much you have it doing. I was bought a couple of RPI’s for xmas and had seen the odd delay so decided to split out across the 2
I know there’s a lot of people who have NUC’s but I wanted to keep the power consumption low and keep the simplicity of HASSIO install.

Both HASSIO installs;
RPi 1 - Interface, state/device management, discovery, MQTT
RPi 2 - Node-Red (all automations)

It’s easy enough migrate so I wouldn’t bother investing in more hardware unless you know your going to get performance issues. Im very happy with my setup but it’s certainly worth considering a NUC given the number of people who seem to be using them.

This ^^^^

The inject and debug nodes are probably the biggest reason to switch over to node red. Giving you the ability to tweak and test repeatedly without system restarts.

1 Like

So I haven’t been able to get this to work. I have it set up exactly like the example but it doesn’t seem to work. Have you gotten this to work?

This is the script:

    nodered_logbook_entry:
        alias: Node Red Log Book Entry
        sequence:
          - service: logbook.log
            data_template:
              name: Node Red
              message: flow started

i log all my NR actions to MQTT with timestamps.

Not a bad idea. But ideally I would like to have them in the logbook so I can follow the sequence of events all in one linear log. But MQTT may be another avenue if this doesn’t work.

They run mostly asynchronous, so there’s not much reason to log them together.
When I am debugging a flow. I sometimes make my own log file using the file node.

then add MQTT sensors in HA to read the NR-MQTT logging.

[{"id":"996a6cc6.45073","type":"inject","z":"5eb3594f.d294b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":780,"y":1712,"wires":[["3e231ef5.6446d2"]]},{"id":"3e231ef5.6446d2","type":"api-call-service","z":"5eb3594f.d294b8","name":"","server":"ef067c6f.620e6","service_domain":"logbook","service":"log","data":"{\"name\":\"Kitchen\",\"message\":\"is being used\",\"entity_id\":\"light.kitchen\",\"domain\":\"light\"}","mergecontext":"","output_location":"","output_location_type":"none","x":956,"y":1712,"wires":[[]]}]
4 Likes