Installing Node-RED, if you know what you’re doing, is about as easy as it gets. This is an update from my previous install that exposed just how much I don’t know about Linux. That’s the reason for the “if you know what you’re doing” disclaimer. Many thanks to those that do know what they’re doing that pointed out the fallacies of not following the developer-recommended script. Speaking from personal experience, if the developer recommended install doesn’t work, check that you’re not missing something. Don’t fall back to Google over the developers; you will easily find many different ways to install, none of which are as easy as the developer script and may have unseen incompatibilities.
Node Red is a fabulous bit of software that can run on just about any always-on device. Similar to IFTTT and what used to be Stringify, NR is a good what to integrate different automations under one “roof”. Different hardware devices, APIs, and services can be wired together in an easy to use visual editor.
First up, the hardware. You can install and run NR on just about anything that is always-on, but in my case I grabbed a Pi4 from Amazon. You can also get one directly from Raspberrypi.org or Best Buy. I would recommend at least getting a kit with a case, cables, and fan. I went with CanaKit since it included all of the above, and the Pi4 does tend to get a little toasty when running. The board starts at $35, but considering what you’d put into a full desktop PC with monitor…$99 for a credit-card sized server isn’t bad at all. It is also a good idea to have a micro-SD card reader so that you can use a PC to get the micro SD card set up prior to booting the Pi for the first time.
Set up the Pi
I’ll refer you to another post on setting up the Pi if you haven’t already done so. Once done there, head back over here. To make the install even easier you don’t have to install VNC viewer; setting up SSH is sufficient since this install really only needs to interact with the Pi in the command line.
The next step is to pull and install NR. The full guide can be found on the official Node-RED site. The basic steps are as follows:
- Run the following command to download and run the install script:
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
- More efficiently use the limited Pi memory by running the following command:
- Start NR as a system service:
- Start NR on boot:
sudo systemctl enable nodered.service
Node-RED should now be successfully installed and run as a system service. To update when new versions are released, run the above install script again. Additionally, unless on a private network you may want to secure your installation.
To access the workspace go to either localhost:1880 in the pi web browser (if using a remote desktop) or http://your.pi.ip:1880 in a browser on the local network. If you don’t know the IP address of your pi you cane look it up using the command
hostname -I in the terminal. I strongly recommend setting a static IP in the DHCP reservation area of your router, as connected services will require it to find your pi.
Now what? What you can do with Node-RED
This is the fun part. Node-RED is a collection of nodes that work together to create a sequence. The collection of sequences on a page is a flow. You can have multiple sequences, and multiple flows. Your node collection is your palette, and you collect new nodes from the palette manager. Your nodes are the core of Node-RED and provide the means to tie together multiple different platforms to create a specific action for a desired trigger. You can use Node-RED with no coding experience (I have none, but Google and forums are my friend) and still have a fully functioning automation environment. I’ve got a few integrations that build out my palette:
- Pushover (for push notifications)
- Phillips Hue
- Lutron Caseta
So, how do these work together to create flows?
Lighting automation example
The above sequence is one of my “simpler” automations. In our odd bathroom, the light that provides the best illumination has a switch that is all the way in the bathroom at the sink. This sequence turns on the bathroom light when the motion detector senses someone come in the door when we are home and turns it off after 1 minute of inactivity. Likewise, nobody likes getting blinded during those middle of the night trips. It will only turn the light on at 15% brightness when the hub is in night or morning mode. The cancel function stops the timer as long as the motion detector detects activity so it won’t turn of in the middle of the important duty.
Node-RED example sequences
In the above flow I’ve only got Hubitat integrated (Hubitat being the hub that controls all of my smart home items…lights, motion detectors, window/door sensors, etc.). However, my other flows have multiple integrations that work together to make life ‘easier’ in the background.
Sequences that make life convenient
- When my wife or I arrive at the grocery store, a sequence starts that determines via Hubitat and Life360 that we are at the store. It pulls our grocery list items from the Alexa integration and sends us a push notification on our phones via the Pushover integration.
- When all of us have left the house, a timer starts when we cross the Life360 geofence. The timer stops if we re-enter the geofence. When the timer completes it sends several commands. First, it tells Hubitat to arm away. Second, it sets the mode to Away and turns off certain lights. Finally, it sends us a notification using Pushover to tell us everything was successful..
Sequences that save me money
- This one really messes with the better half…but I don’t like heating/cooling the outdoors. So if a contact sensor is left open for more than 20 minutes it automatically cuts off my HVAC system and sends a message to our phones that it is off. When the door/window closes, and stays closed for 5 minutes, the HVAC is turned back on. Now I’m not completely cruel…it only does it if the outside temperature is above 72 degrees.
- I’ve got water sensors on both HVAC units and the water heater. Nobody likes surprises that involve a water leak. I am sent a notification via Pushover if any sensor detects water.
I’ve found the best way to learn NR is to work with it, and when in doubt ask the NR forum. Other home automation forums are good resources for information specific to their platform. Hubitat, for example, has a thread dedicated to NR flows. For registered users I also have the flows I use in a separate post on this site (must be registered and logged in to see the link). Something fun with NR is that there’s always more ways than one to accomplish the same task, and I get a lot of my sequence ideas from forums and seeing what others use in their own home automation systems. As always, if you have questions or comments on improvement, drop them below.