Node-RED is a visual programming tool that makes it easy to create rules for home automation. It is a free, open source tool that runs any-where, from a Docker to a Raspberry Pi or other computer. It is easy to install and easy to use, and you should be running it.
I consider Node-RED to be one of the necessary pieces of software that everyone should run on their home automation server. Along with Home Assistant and MQTT, Node-RED forms the foundation of a solid home automation experience.
Let's talk about what Node-RED does for your home automation experience. I'll give you 7 reasons that you should be running Node-RED on your server right now.
Node-RED Is Easy to Get Started with and Easy to Use
Since Node-RED is available in a fully functional Docker container, it's a slam dunk to get started using it. Simply install the latest Docker image, fire up a container, and start playing around. You can be up and running in 5 minutes.
The Docker image is sufficient for just about any home automation use case. If you want to run Node-RED on a Raspberry Pi, you can do that too. The Docker image is available for ARM processors, so you can run it on a Raspberry Pi or other ARM based computer.
While you can install Node-RED natively on your computer, I don't recommend it. The Docker image is the easiest way to get started with Node-RED. Plus, the Docker image is always up-to-date, so you don't have to worry about keeping Node-RED up to date.
Node-RED Rules Are Easy To Create
If you have tried to write even moderately complex rules in Home Assistant, then you know that it can be a frustrating experience. Home Assistant is a great piece of software, and I think that everyone should be running it. The only problem that I have with Home Assistant is that the rules are written in YAML. This means that for non-programmers, Home Assistant rules can be not very intuitive. It is also very easy to make a minor formatting mistake and break your Home Assistant rules.
If you are like me, you have probably spent hours trying to debug your Home Assistant rules. This can be very frustrating and time-consuming. Many times I have given up on a Home Assistant rule because it was either too hard to implement, or too hard to understand it after I wrote it.
Instead of writing your rules in Home Assistant based YAML, you can write all of your automations in Node-RED. Node-RED is a visual programming tool that makes it incredibly easy to create complex rules for your home automation. The rules are easy to create and easy to read later. I have not found any rules for my home automation that I could not create in Node-RED. Furthermore, since migrating my rules to Node-RED I've found the rules to be much easier to understand and debug.
Node-RED Rules Run Fast
You might think that because Node-RED is a visual programming tool that it would be slow, but it is actually very fast.
Behind the scenes, Node-RED runs on Node.js, which is a very fast programming language. You can easily run thousands of rules on Node-RED without any noticeable performance issues.
As with all home automation, any delays that you experience are most likely going to be related to the speed of your network and the speed of your devices. Node-RED is unlikely to ever be the bottleneck in your home automation system.
Node-RED Integrates with Almost Everything Natively
Home Assistant is the king of talking to everything, but Node-RED is not far behind. Node-RED has many native integrations that make it easy to connect to almost any device or service. Since Node-RED is written in Node.js, it can easily talk to any device or service that has a Node.js library. This covers a lot of ground, and there are many Node.js libraries available for almost any device or service that you can think of.
However, you don't need to talk to most things with Node-RED directly. I suggest using Home Assistant to talk directly to most things, and Node-RED to run your rules. You can also have a sort of hybrid approach where both Home Assistant and Node-RED talk to some things at the same time. Your MQTT broker is a great example of something that both Home Assistant and Node-RED should talk to. Home Assistant talks to the MQTT broker to get the status of my devices and send control messages to those devices, while Node-RED listens to the MQTT broker to respond to some events that Home Assistant isn't set up to listen for.
There are over 4,000 nodes already written by community members. You can use these nodes to connect to almost any device or service. And, installing these community nodes is as easy as clicking a button in the Node-RED interface.
Node-RED Rules Can Coexist with Home Assistant Rules
When you decide to take the plunge and start writing a few Node-RED rules, you don't have to abandon any Home Assistant rules that you have already written. Both Home Assistant and Node-RED can run side-by-side, and you can use both to run your rules.
As you develop your Node-RED skills, you can slowly migrate all of your Home Assistant rules over to Node-RED a few rules at a time.
Node-RED Rules are Easy to Monitor
When you load the Node-RED interface you are presented with all of your rules in a nice visual format. You can see all of your rules at a glance, and you can easily see which rules are currently running. This makes it easy to monitor your rules and see if any of them are not running correctly.
Since your Node-RED rules are easy to see on screen, it's also easy to monitor the state of your rules. Each node has a bit of information displayed while Node-RED is running. It might be the last time a switch was toggled, or the last time a sensor was updated. If you subscribe to an MQTT topic of a temperature sensor, then you can see the latest temperature and timestamp.
It's quick and easy to see all the recent changes and actions that Node-RED has taken. You can use Node-RED to monitor the state of your home automation system. If you see that a rule hasn't been triggered in a while, then you can check to see if the rule is still working correctly. If you see that a temperature is out of range, then you can check to see if the sensor is still working correctly, and if so, then you can adapt your rule to respond to the new temperature as you see fit.
Node-RED Is Fun
Let's face it, only part of home automation is about making things in your life more useful and easier to use. The other reason that we do home automation is that it is fun. Once you start automating rules with Node-RED, you'll see just how fun automating things can be.
It's easy to sit down for an evening and whip up a couple of new rules for something fun or quirky.
Ring a bell when someone opens the refrigerator at night? Easy!
Turn on a sprinkler when you detect motion on the lawn? Piece of cake!
Node-Red brings a certain amount of fun back to home automation that Home Assistant just can't match.
How to Use Node-RED in Your Home Automation
For me, the big 3 necessary services in home automation are Home Assistant, Node-RED, and MQTT. Here's how I use each of them:
- Home Assistant - Use Home Assistant to talk to devices and remember their last state.
- Node-RED - Node-RED is the rules engine that reacts to events and states. Use Node-RED to write rules.
- MQTT - MQTT is the communication protocol that glues various devices together, especially home-made devices. Try to connect as many devices to your MQTT broker as possible.
Once you have these three services in place, you'll have a hard time finding a problem that you can't automate.