Home Assistant Community Add-on: Node-RED

There is a .node-red folder within /config which I think you can just delete once you have uninstalled the add-on.

Take the following steps:

  • Ensure you have the latest Supervisor (121)
  • Ensure you are running the latest version of the add-on (v0.5.0)
  • Set the server url to http://hassio/homeassistant
  • Save/deploy your workflow
  • Close any open Node-RED tabs in your browser
  • Go into the Hass.io panel, restart the Node-RED add-on
  • Check the logs, an informational message about “Fixing” your API token should be shown.
  • Open Node-RED, check the server configuration: An API token should now be in the password field.
  • Done!

thanks for the quick reply… Followed your steps, by removing the existing password but keeping the server URL field populated as you suggest. Doesn’t appear to be any messages about fixing API token :

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Hass.io Add-on: Node-RED v0.5.0
 Flow-based programming for the Internet of Things
 From: Community Hass.io Add-ons
 By: Franck Nijhof <[email protected]>
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 02-updates.sh: executing... 
INFO: You are running the latest version of this add-on
[cont-init.d] 02-updates.sh: exited 0.
[cont-init.d] 10-requirements.sh: executing... 
[cont-init.d] 10-requirements.sh: exited 0.
[cont-init.d] 11-warning.sh: executing... 
[cont-init.d] 11-warning.sh: exited 0.
[cont-init.d] 20-config.sh: executing... 
[cont-init.d] 20-config.sh: exited 0.
[cont-init.d] 30-auto-api-token.sh: executing... 
[cont-init.d] 30-auto-api-token.sh: exited 0.
[cont-init.d] 80-system-packages.sh: executing... 
[cont-init.d] 80-system-packages.sh: exited 0.
[cont-init.d] 81-npm-packages.sh: executing... 
[cont-init.d] 81-npm-packages.sh: exited 0.
[cont-init.d] 82-user-scripts.sh: executing... 
[cont-init.d] 82-user-scripts.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
> [email protected] start /opt
> node $NODE_OPTIONS node_modules/node-red/red.js "--settings" "/etc/node-red/config.js"
26 Jul 12:14:16 - [info] 
Welcome to Node-RED
===================
26 Jul 12:14:16 - [info] Node-RED version: v0.18.7
26 Jul 12:14:16 - [info] Node.js  version: v8.11.3
26 Jul 12:14:16 - [info] Linux 4.14.54-v8 arm64 LE
26 Jul 12:14:19 - [info] Loading palette nodes
26 Jul 12:14:31 - [warn] ------------------------------------------------------
26 Jul 12:14:31 - [warn] [node-red/rpi-gpio] Info : Ignoring Raspberry Pi specific node
26 Jul 12:14:31 - [warn] ------------------------------------------------------
26 Jul 12:14:31 - [info] Settings file  : /etc/node-red/config.js
26 Jul 12:14:31 - [info] User directory : /config/node-red/
26 Jul 12:14:31 - [info] Server now running at http://127.0.0.1:1880/
26 Jul 12:14:31 - [info] Active project : Hassio-Node-Red
26 Jul 12:14:31 - [info] Flows file     : /config/node-red/projects/Hassio-Node-Red/flows.json
26 Jul 12:14:31 - [info] Starting flows
26 Jul 12:14:32 - [info] Started flows

Interesting!

You are using the projects feature, that indeed breaks stuff. I need to revisit the logic behind this.

That’s my issue too I guess projects feature didn’t know I was using this. Now need to figure this out! At least It looks like I know the problem now!

I managed to work around the issue by uninstalling the add-on. Steps I took

  1. Export all node-red flows within Node-red into a text file
  2. Copy the add-on settings from the node-red add-on page in home-assistant into a text file
  3. Stop Node-red add-on
  4. Reboot the raspberry pi (probably not needed)
  5. Delete the /config/node-red folder when you ssh into Hassio
  6. Reinstall the add-on
  7. Before starting the add-on copy back the settings from step 2.
    8 Start the add-on
  8. check the log to see everything loaded ok
  9. Access node-red through the browser
  10. Import the flows exported in Step 1.
  11. Under Menu->Configuration nodes you will likely have two Home-Assistant entries. Double click the one that has (0) items (this is the new one that has the correct credentials)
  12. Copy the API Pass
  13. Now double click the other Home-Assistant entry and paste in the API pass from the previous step
  14. You can delete the new configuration node with zero items by opening it as per step 12 and clicking delete.
  15. Clock deploy and hopefully rejoice.
4 Likes

Hi all. I’ve tried to include this add on, but depsite no error messages in the log when I try to access the web url (https://127.0.0.1:1880/) there is nothing. Any ideas what I’ve done wrong?

Welcome to Node-RED

28 Jul 10:20:02 - [info] Node-RED version: v0.18.7
28 Jul 10:20:02 - [info] Node.js version: v8.11.3
28 Jul 10:20:02 - [info] Linux 4.4.50 arm LE
28 Jul 10:20:04 - [info] Loading palette nodes
28 Jul 10:20:05 - [warn] Cannot find Pi RPi.GPIO python library
28 Jul 10:20:10 - [warn] ------------------------------------------------------
28 Jul 10:20:10 - [warn] [node-red/rpi-gpio] Warning : Cannot find Pi RPi.GPIO python library
28 Jul 10:20:10 - [warn] ------------------------------------------------------
28 Jul 10:20:10 - [info] Settings file : /etc/node-red/config.js
28 Jul 10:20:10 - [info] User directory : /config/node-red/
28 Jul 10:20:10 - [warn] No active project : using default flows file
28 Jul 10:20:10 - [info] Flows file : /config/node-red/flows.json
28 Jul 10:20:10 - [info] Server now running at https://127.0.0.1:1880/
28 Jul 10:20:10 - [info] Starting flows
28 Jul 10:20:10 - [info] Started flows

I started using this node-red add-on versus the one that was just deprecated (NotoriousBDG). I seem to be having an issue where the flows are triggering to HA slowly (about 10 seconds delay). Even if I setup a new flow (versus imported) it delays 10 seconds. On the other one it was instant.

I turned on debugging and the flow is running immediately but there seems to be a delay between node-red and HA. I also re-installed the deprecated one with same flows and they are instant. Any ideas?

Where do you find the credential secret? I think I’m having the same problem but I dont know what to put in there.

Thanks

127.0.0.1 is an internal IP for the add-on. Please use the ‘Open web UI’-button at the top.

Note: if accessing via a duckdns.org while port 1880 is not forwarded it won’t work,
in that case, manually go to https://YOUR_RASPI_IP_ADDRESS:1880.

Your Node-RED credentials are encrypted by Node-RED in storage, using a secret key.
The credential_secret can be anything, this just gives you the option to specify ‘a’ secret key.

You won’t need it anywhere else, but once set, you should NOT change it. If you do it will prevent Node-RED from being able to decrypt your existing credentials and they will be lost.

Unfortunately, nothing loads when using the open web UI button either, which is why I tried the link from the log (from within my own network anyway). Do I need to forward the port even to access from my own network?

EDIT: I was using my duckdns instead of the IP… Thanks for pointing me in the right direction!

I can’t figure out how to configure Python path.
Docs didn’t help much. :frowning:

I tried to modify Add-on Config:

  • init_commands": ["export PYTHON=/usr/bin/python"]
  • system_packages": ["make","python"]
  • npm_packages": ["node-red-contrib-homekit"]

Tried in terminal:

  • npm config set python “/usr/bin/python3”
  • npm --add-python-to-path=‘true’ install node-gyp

Always ending up with:
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.

How can specify env variables?

Thanks :penguin:

I recently wiped my hassio system to start fresh. I was using the old NotoriousBDG add-on, but decided to go with this one for the new setup. I imported my old flows and updated the connection to use the http://hassio/homeassistant url. Everything looks ok. The events say they are connected. The odd thing is none of the nodes ever update with the last changed timestamp. With my old setup whenever a service was called it would display text just under the node showing the last executed timestamp. Is this just a configuration somewhere that I am missing? Without any feedback it is hard to tell that is is actually trying to execute services or not.

I have also noticed these periodic errors coming from the event state nodes: “TypeError: Cannot read property ‘state’ of null”

@frenck how can I rebuild this addon? I imported someone else’s flow and now I have a constant debug message of "Home assistant connection failed with error: Connection to home assistant could not be established with config: https://Fake_HA_Server.duckdns.org:8123 ". I just want to start over but uninstalling doesn’t seem to fix it.

Upgraded to HA v0.75.0 this morning and the node-red addon log is full of messages about bad auth:

4 Aug 12:26:57 - [error] [server:Home Assistant] Home assistant connection failed with error: Connection to home assistant could not be established with config: http://hassio/homeassistant <password redacted>

I tried to edit the server data, deleting the API pass, deploying and restarting node-red but no luck.

The api pass is suposed to be updated by the addon:
[cont-init.d] 30-auto-api-token.sh: executing... INFO: API token is incorrect in the Node-RED configuration, fixing...

Still getting these sporadically as well, but it stops out of nowhere, no idea why.

Have tried downgrading hass.io to v0.74.2 but no luck, same errors regarding node-red auth errors.
Back to v0.75.0 the problem persists, I don’t know if it is related to hassio supervisor, now in v123 (haven’t managed to downgrade supervisor to 121)

@frenck did you experience this behaviour? Is it possible meanwhile to connect to Home Assistant specifying the ip and password with https?

I’m experiencing the exact same behavior as foraster since moving to v0.75.0. I’m running hassio on an Intel NUC. I’m on supervisor 123. I’ve tried a wide variety of server addresses in node-red, but couldn’t get anything to work.

Temporary solution found: use the external home assistant url: https://whatever.domain.is and the password defined for home assistant. Using the https address with the internal ip and the port did not work for me.