Node-Red and Hass.io via SSL on Separate Servers

Hass.io with the node-red add-on was very slow for me, so I moved node-red to another server. My hass.io box is running SSL, and node-red on the other box was having difficulty connecting. For search purposes, this was the spammed error message I received in node-red’s logs:

  • Home assistant connection failed with error: Connection to home assistant could not be established with config…

In order to get SSL working between boxes, this is what I did:

  • Install node-red: sudo apt-get install nodered

  • Install: node-red-contrib-home-assistant

  • Edit settings.js (launching node-red will tell you the path, but it should be /pi/username/.node-red/settings.js). Username and admin access can be configured from here (e.g., httpNodeAuth), but for SSL, uncomment the https section, pointing the certificates to the following. Also, uncomment the definition of fs in the first few lines of the settings.js file.

    https: {
    key: fs.readFileSync(’/ssl/privkey.pem’),
    cert: fs.readFileSync(’/ssl/fullchain.pem’)
    },

  • Copy the LetsEncrypt certificates, both public and private, from your main hass.io box. This isn’t a great solution, because we’ll have to update the certificates on the Node-Red box manually, but it works for now.

  • Start node-red

  • Add a home-assistant service to your flow, and configure the server. The server should be the name of your server when you generated your certificate. This is your hostname from your domain service.

Done! After many struggles and not finding any help directed to this particular problem online, this was the solution that worked for me. I hope this helps someone else.

And for what its worth, offloading Node-Red onto a separate box restores hass.io’s performance.

Hey I just tried this now but both node-red and HA are on the same box. Will this only work for when you have the two separate pi’s?

These instructions are intended for setups with separate servers, yes. Running node-red and hassio on the same box is a much more common configuration - following the addon instructions should set you up just fine.