NodeRED and Hassio – Install & Setup

So you’ve got Hassio up and running.  You’ve probably got a few smart switches and lights, maybe some sensors and even presence detection.  Now the real magic in Home Automation is getting all those smart devices to work together to make your house feel alive.  With Home Assistant you can do that with automations or scripts. But there is another, potentially better way using an Add-on called NodeRed.  Sounds interesting… let’s check it out.

 

NodeRed isn’t new.  It started out as an idea to make a visual, flow-diagram-like interface for mapping out MQTT messages.  It has quickly become one of the most popular platforms for the IoT. NodeRed is open source and of course free to use.  I want to use NodeRed to augment my Home Assistant experience. Fortunately for us Hassio users there’s a simple way to get HA and NodeRed working together.

 

Step one is to copy this repository URL: https://github.com/notoriousbdg/hassio-addons

https://github.com/notoriousbdg/hassio-addons

Not to be confused with Notorious BIG.  RIP Mr Smalls.

 

Now open HA and go to the Hassio tab, then to the “Add-on store”, and where it says “Add New Repository” paste the URL you just copied. Scroll down and you’ll see a new box for NodeRED. Click that box, then on the next page just hit “Install”, then click “start”.  Installing and Starting nodeRed took a few minutes. Be patient. Go get a sandwich or something. Now just click the “Open WebUI” button to see NodeRED. The default login is admin and password. To change the password, go to the “Config” box on the NodeRED hassio page and set the user and password to whatever you like.  If you’re using SSL, you also need to change the SSL line from false to “true”. If you’re accessing HA using DuckDNS, you will probably need to get into your router and forward port 1880 to your HA rpi. Every router is different. For what it’s worth here’s what my Port-Forwarding page looks like for my NetGear router.

 

The next step is connecting NodeRed to Home Assistant so you can use your HA devices as nodes, so you can use them in your flows. To do that we need to install the a HA component to our Palette. From the NodeRED main page, click the hamburger icon, then click “Manage Palette”. Go to the “Install” tab and search for home-assistant. A few choices will pop up.  The one we want is called “node-red-contrib-home-assistant”. We can ignore those others, we only need that one. You’ll get a warning about dependencies, but there aren’t any dependencies for this component, so just click install. It may take a few minutes to install. Time to go get another snack! You’ll have to restart NodeRed from the Hassio add-on page for the component to finish installing. When NodeRed starts back up, you should have a submenu on the left called Home Assistant.  The last thing we need to do is add your instance of Home Assistant as a server. Select one of the HA nodes and drag it to the middle. Click on it, then where it says “Add new Server” put your HA information. That’ll be the IP address or URL of your HA rpi with the port 8123, and your API password if you have one. If you’re using SSL you must use https:// and your duck DNS url instead of your local pi IP address. That’s the password you use to login to HA. Now to test our install we can finish inputting the settings for this node. Choose the Domain, the service, and the entity ID.  For the entity you’ll need the json text, you can get that from the services page in HA. Copy everything, including the squiggly brackets and paste it into the node. All the nodes that say “state” will import the entity_ids from Home Assistant. But for call service you need to input the json text. Click done, then drag the “timestamp” node. That just gives you a button to click that will start the flow. Connect the two nodes with a line. Then hit “Deploy”. I’ve got my Floorplan open here so we can see if the light toggles when I click the Timestamp. And hazzah! Magic!

 

One more thing to do before we officially consider this project “finished”.  This is optional, but it’s handy. Let’s add a button to make it easier to get into NodeRed.  Open up your configuration.yaml file, and add this.

panel_iframe:

 nodered:

   title: ‘Node-Red’

   icon: ‘mdi:shuffle-variant’

   url: ‘http://192.168.1.64:1880/

 

The url will be the IP address or URL of your HA rpi with port 1880 at the end.  Save your config, and restart HA.

 

Well, that’s it we’re done with the setup of NodeRed in Hassio.  Now if you really want to get the most out of NodeRed you’ll want to get some flows put together.  You can start by converting your HA automations into flows, to get a feel for how it works.  There are a lot of videos out there to help you along the way.  

NodeRED might not be as easy as it appears.  Be patient, set low expectations, and eventually you’ll figure it out and have a powerful new tool for your Home Automations.

The End

Social Links

Menu