How to Install Node-Red to Home Assistant

This guide will show you how to install Node-Red to Home Assistant and take you through a basic flow.

Node-Red on Home Assistant

Node-Red is a low-code development tool for building simple to complex automation flows. The software runs within a web browser and works great within Home Assistant. The software is relatively easy to learn and allows easy viewing of complex logic flows.

Using Node-Red gives you an excellent visual overview of automation flows, making it much easier to understand, edit, and create. You can build flows that control automatic gates, lights, water pumps, and more.

If you haven’t already, we recommend installing Home Assistant to a Raspberry Pi or another spare computer.

This tutorial will explain how to install Node-Red to Home Assistant. We also go through the basics of setting up an automation flow. Both of these topics give you a decent insight into how you can get the most out of the software.

Installing Node-Red

The installation of Node Red is very straightforward, but there are a few requirements for a smooth installation process.

To install Node-Red within Home Assistant, you must run a version that supports add-ons such as supervised or the operating system. Alternatively, you can set up Node-Red as a separate docker and connect it to Home Assistant.

1. Within the Home Assistant web interface, click on the settings tab and then click on add-ons.

Home Assistant Settings Page with Add-Ons

2. Click on add-store in the bottom right corner of the screen.

Click on Add-on Store Button

3. Using the search box, search for Node Red. Alternatively, you can scroll through the page until you find the Node-Red add-on.

Add-On Store Search Node-Red

4. The page you should now see will contain all the details about the add-on. You can check through all the details if you want to know what you are about to install. Once you are ready to install, click Install.

Home Assistant Node-Red Install Screen

5. Now, navigate to the configuration tab. In this tab, locate the credential_secret field and enter a strong password. Make sure you save this password, as you may need it in the future. I use 1Password for storing passwords, but other software such as Bitwarden or Nordpass (Affiliate Link) would also be solid choices.

You will also need to disable SSL if it is not enabled on your Home Assistant installation. To disable SSL, click the SSL button so it is greyed out. If you leave it on and Home Assistant does not support SSL, Node-Red will fail to start.

Once you are done, click on save.

Node Red Credential Secret and Disable SSL

6. After you have saved the credential secret and disabled SSL, return to the info tab. On this page, click on “Start“. Node-Red should start without issue. If it is not starting, navigate to the log tab and look through the logs for errors.

Home Assistant Node-Red Installed

7. If you click on Node-Red in the sidebar or “Open Web UI” on the add-on page, it will take you to the Node-Red application. You can now start writing your flows to automate your Home Assistant setup.

Node Red Started

Creating your First Node-Red Flow

Node-Red can be a little daunting at first, but once you understand the basics, it is a powerful tool that allows you to handle complex and simple automations.

In this short tutorial, we will go through the basics of creating a flow that uses a Home Assistant node.

The following steps will take you through how to send a notification whenever the temperature of our weather station exceeds 15°C.

1. The first node we will use is the “Events: State” node. Drag this node onto the grid

Create Events State Node

Next, double-click on the node to open the options available. Fill in each of the relevant properties. Below is what I filled in.

  • Name: Check Temperature
  • Server: Home Assistant
  • Entity: Outdoor Temperature
  • If State: >= 15 (Greater or equal to 15)
  • For: 1 Minute
  • State type: Number

I also do not have any checkboxes ticked for “Ignore State Change Event When“.

State Node Properties

2. Next, drag and drop a debug node. These nodes will output data that can help diagnose and fix issues with your flows.

Node-Red Nodes

On each node, there are dots. These dots represent different functions. For example, our Check Temperature node has two dots. One is for when our logic is false, and the other for when it is true.

We click and drag our true node and connect it to the debug node.

Node-Red Debug Nodes

The flow will run when you click deploy in the top right-hand corner.

In this example, if the temperature exceeds 15°C, the debug node will output after 1 minute. If it is not higher than 15°C, nothing will output.

Sidebar Debug Info

3. Next, we will want to notify our users that the temperature is too high. To do this, drag a “Call Service” node onto the grid. Connect the true output to the input on the “Call Service” Node.

Call Service Node

Now, double-click on the call service node to edit it. Fill in each of the relevant properties. Below is what I filled in.

  • Name: Enter the name that you want the node to be referred to.
  • Server: You shouldn’t need to update this as it should be Home Assistant.
  • Domain: You will need to set this to notify.
  • Service: Choose a device that you wish to notify. Choosing the notify option will notify all possible users.
  • Data: This is where you need to specify the notification details. At the bottom of the properties is an example. Clicking “Load Example Data” will pre-populate the data field, which you can easily edit.

Below is an example of my entry into the data field.

{
   "message":"Temperature is too High!",
   "title":"The temperature is higher than 15°C."	
}
Call Service Node Properties

4. To avoid too many notifications, you may want to place a delay node. This node will allow a single notification to be sent for a specified time. To do this, drag and drop a delay node in between our check temperature and notify gus nodes.

Node Red Rate Limit

Double-click on the delay node and update the settings to the following.

  • Action: Rate Limit and All Messages.
  • Rate: 1 msg(s) per 15 minutes.
  • Change Queue Intermediate Messages to Drop Intermediate Messages
  • Name: Rate Limit

These properties will allow a single message every fifteen minutes. Any messages that try to be sent in the meantime will be dropped.

Delay Node Properties

5. You should now have a basic flow that will notify users whenever the temperature goes above 15°C for over a minute. Feel free to change and alter this flow for other purposes.

You can remove the debug node if you are finished debugging. Alternatively, you can click the green square next to the node to deactivate it.

Node Red Disable Debug

Conclusion

I hope you now have Node-Red installed and configured on your Home Assistant installation. Our basic flow introduced some basics of using the software to run automations. Once you understand the basics, you can create some cool automations using the data from some of the sensors and devices in your home.

We are constantly working on more Home Assistant tutorials, so if there is anything that you would like to see, please let us know. I recommend checking out some of the other tutorials for great ideas on what you can do with this amazing software.

If you encounter any problems or have any suggestions, please do not hesitate to leave a comment down below.

Leave a Reply

Your email address will not be published. Required fields are marked *

2 Comments

  1. Avatar for Steve
    Steve on

    I’m following your instructions, but…
    There is no Add-Ons option under Settings.
    Any idea of where to find it?
    I installed Homeassistant just now. I assume I have the latest version.

    1. Avatar for Gus
      Gus on
      Editor

      You should check the version of Home Assistant you are using. Certain versions, such as the Docker version, do not support add-ons. You will need to install Node-red in a separate Docker container and connect it to Home Assistant.

      You could also go directly to the add-ons page by going to the following URL in your browser. http://homeassistant.local:8123/hassio/dashboard