Today, I’m going to talk about Node-RED briefly, what it is, how to install it as an add-on in Home Assistant, and walk through some basic flows to demonstrate what automations you can set up easily. Node-RED is a visual programming tool that allows you to create flows by connecting nodes together. It can be used independently or integrated with Home Assistant to enhance automation capabilities.
To install Node-RED as an add-on in Home Assistant, follow these steps:
- Open Home Assistant and go to “Settings.”
- Click on “Add-ons.”
- Here, you’ll find the list of installed add-ons. To explore more options, click on “Add-on Store.”
- Search for “Node-RED” in the add-on store and click on it.
- Click on “Install” to start the installation process. The duration of the installation may vary depending on your equipment’s speed. For example, installing it on a Raspberry Pi might take longer than on a virtual machine.
- Once installed, you can configure the add-on. It is recommended to enable the Watchdog option to automatically restart Node-RED if it crashes. You can also enable the Auto Update option if you prefer automatic updates. Additionally, enabling the “Show in Sidebar” option will display Node-RED in the left-hand sidebar of Home Assistant.
- Start the add-on by clicking on the “Start” button. However, before starting, you may need to set up credential secrets. If the logs show errors, go back to the configuration and create a secret by entering the necessary credentials (e.g., username, password) for secure external access to Node-RED.
- After setting up the credentials, start the add-on again. Check the logs to ensure a successful start.
Once Node-RED is installed and running, you can access it by clicking on the Node-RED link in the sidebar. In Node-RED, you can create flows by connecting nodes. There are different types of nodes depending on what “palettes” are installed. Nodes related to Home Assistant are automatically installed with the add-on, along with other common nodes used in Node-RED.
To demonstrate a basic flow, follow these steps:
- Create a new flow by clicking on the “+” button at the top.
- On the left-hand side, you’ll find nodes related to Home Assistant. Drag and drop the “Events State” node onto the flow.
- Double-click the “Events State” node to configure it. Specify the server (Home Assistant), and choose a Home Assistant entity from the list.
- Configure the desired state change condition in the node. For example, define a change state or leave it open to trigger events for any state change.
- Connect a “Debug” node to the “Events State” node.
- Double-click the “Debug” node to change its configuration. Modify the output to “Complete message object” to display all information from the previous node.
- Deploy the flow by clicking on the “Deploy” button.
- Test the flow by triggering a state change in Home Assistant.
- Monitor the state changes and outputs in the debug panel in Node-RED, you will see the output in the form of a formatted json message.
What the YouTube video above where we go through more examples!
Node-RED provides various nodes for different purposes, such as calling Home Assistant services, getting current entity states, handling events, using timers, and more. You can customize your flows based on your automation requirements.
Your Node-RED configuration will get backed up as part of the Home Assistant back-up if you are using the add-on.
Note: The provided instructions assume you have Home Assistant and Node-RED installed together. You can install Node-RED on it’s own without Home Assistant if you wish, there is even an Android version!