How to Set Up Node-RED on Home Assistant

  • Post author:WunderTech
  • Post published:January 19, 2023
  • Post last modified:May 10, 2024
  • Post category:Home Assistant
  • Reading time:9 mins read

This tutorial will look at how to set up Node-RED on Home Assistant!

Node-RED is a visual editor that allows you to set up various different types of automation in Home Assistant. While you can set up various different types of automation in Home Assistant directly, the GUI editor that Node-RED provides is extremely helpful and very easy to use. Please keep in mind that you must have different devices connected to Home Assistant to configure Node-RED automations, but most users will already have devices connected to Home Assistant.

How to Set Up Node-RED on Home Assistant

We will look at how to set up Node-RED below!

1. Open Home Assistant, then select Settings and Add-ons.

home assistant add-ons.

2. Select Add-on Store, then search for Node-RED and select it.

node-red search in home assistant.

3. Select Install to install the Node-RED application.

node-red install in home assistant.

4. After Node-RED is installed, select Configuration to configure the settings needed for Node-RED.

node-red top tab after installing.

5. Set a crednetial_secret, which is a password used to encrypt sensitive information.

adding an encryption key to node-red.

6. If you do not have SSL enabled on your Home Assistant instance, you will have to uncheck SSL. After you do that, select Save at the bottom, then select Info.

disabling ssl in home assistant for node-red.

7. Enable Watchdog and Show in Sidebar (unless you don’t want it to), then select Start!

changing the node-red settings and starting it.

7. Node-RED will then start and can be accessible from the sidebar! You can also select Open Web UI to launch the web user interface!

node-red fully installed and accessible! how to set up node-red on home assistant

Node-RED Automations – How to Set Up Node-RED on Home Assistant

At this point, Node-RED is installed and accessible, however, you must go through and configure different automation based on the requirements you have. It’s difficult to say exactly what will be needed based on the type of automation you’d like to create, but I’ll point out a few things that could be helpful in configuring Node-RED.

Debug Node – How to Set Up Node-RED on Home Assistant

The Debug Node is one of the most common node types you’ll use. The main reason is that it’ll allow you to see an output of an object type which can be extremely helpful in determining how to set up different node types (states, services, etc).

1. To create a debug node, drag it onto the editor, then double-click it.

node-red debug node.

2. Change the output from msg.payload to complete msg object. Select done, then add a node in front of it (my favorite is the events:state node). Update the settings in the first node, then select Output on Connect at the bottom of the states node.

node-red options in events:state node.

3. Drag the output to the input of the debug node, then select Deploy in the top right.

basic node-red flow.

4. After deploying, select the debug icon in the top right.

node-red debug tab.

5. You should see that an object will appear and you’ll be able to navigate through it to see the current state and information about the item. At this point, you can create a new flow that will allow you to automate an action based on this state.

node-red debug output.

6. An example flow that I’ll show below will wait 25 seconds after a door is unlocked to see if it’s still unlocked. If it is, it will perform an action to lock the door automatically.

node-red basic flow of a lock locking after being unlocked.
node-red lock settings.

7. This is an extremely simple flow, but very powerful. It can also be significantly more complex if desired, meaning that door sensors can be added to the door to check after 25 seconds if the door is closed. If it is, the door can automatically lock – if it’s still open, the door can stay unlocked, and a wait until action can be added that will wait until the door is closed. As soon as it’s closed, the door will lock.

lock example waiting for door to be closed before locking.

8. This is just an example of some of the flows that can be configured in Node-RED. There are many, many powerful flows that can be added which will automate various items in your home, and Node-RED makes it extremely easy.

Conclusion: How to Set Up Node-RED on Home Assistant

This tutorial looked at how to set up Node-RED on Home Assistant. Overall, Node-RED is incredibly powerful and is one of my favorite add-ons for Home Assistant. The different automation types you can create are truly incredible and it’s so easy to understand how they’ll work based on the GUI. If you’re interested in setting up different automation, I’d highly suggest at least installing Node-RED and playing around with it. The possibilities are truly endless!

Thanks for checking out the tutorial on how to set up Node-RED on Home Assistant. If you have any questions on how to set up Node-RED on Home Assistant, please leave them in the comments!

WunderTech

WunderTech is a website that provides tutorials and guides on various NAS, server, networking, and infrastructure-related topics. WunderTech is maintained by Frank Joseph, an IT professional with 14+ years of experience in corporate IT and application management. He focuses on sharing his experience with others on his WunderTech website and YouTube page. Frank holds a Bachelor of Science in Computer Information Systems and a master of Business Administration (MBA).

This Post Has 2 Comments

  1. Ed

    Hi,

    Thanks for the article.

    I also could setup a separate docker container with node-red rather than using the add-on from within home assistant. Any thoughts pros/cons on both methods?

    Regards,
    Ed

    1. WunderTech

      I think it would depend on the hardware you’re using. If one is significantly better than the other, you might choose to put it there. For what it’s worth, I’ve had it running on my HA instance for a while with no problems whatsoever.

Comments are closed.