Node RED is a Flow based programming interface that is somewhere between block and text based coding. It can be an easy way to program automations for Home Assistant that are a bit more advanced than what can be done with the Automations menu.

Add Node-RED

From the ADD-ON STORE, scroll down to find Node-Red and click on it.

  1. Click the INSTALL link.
  2. Once Installed, scroll down to the Config section.
  3. Set a credential_secret, which is used to encrypt sensitive data. This is just a password, which you should save in a secondary location.
  4. Next set ssl and require_ssl to false.
  5. Click the SAVE link
  6. Now scroll up and click the START link.
  7. This can take a few moments to start up, but you can check the log at the bottom of the page to see when Node-RED is up and running.
  8. If desired, turn on the Show in sidebar
  9. Once finished, you can now click on the OPEN WEB UI link or the Node-RED menu link to open Node-RED.


If you get an error "502: Bad Gateway" this could indicate that Node-RED is not fully loaded. Check the Log to see Node-RED is still loading or to read any errors while loading.

Setup Node-RED MQTT Client

Since we have already installed the MQTT Broker we may as well set up Node-RED to use that for sending and receiving data from connected devices right?

Scroll down to find the mqtt node under input or output.

Move the mqtt node to Flow 1

Double click on the mqtt node to open it's Properties window.

Click the Edit icon to add a new MQTT broker.


Under the Connection tab, add your MQTT Server address.

This will be the same IP address as your Raspberry Pi unless you are using another MQTT server like Adafruit.IO

Next click the Security tab.

Add the Username and Password that you set for your MQTT server.

Now click Add

If you misplaced your MQTT credentials, they can be found by going to the menu and click on Mosquitto broker. The Password and Username should be in the Config field.

That will add your connection and your can now set a topic to interact with. As a test, I will usually add and inject node to send a time stamp to the mqtt node under output with a Topic of "test". Then I will get another mqtt node from the input section, set it's Topic to "test" and connect it to a debug output.

When you click the tab next to the timestamp inject node it will send the Unix time to the topic "test" via MQTT. Once that happens, the mqtt node set as input will receive that update and send it to be printed in the debug log.

This guide was first published on Oct 02, 2019. It was last updated on Jul 12, 2024.

This page (Node Red) was last updated on Mar 08, 2024.

Text editor powered by tinymce.