Home Assistant Community Add-on: Node-RED

@commandcontrolit this may explain what is going on (from another thread) and a recommended replacement.

1 Like

Thank you - Iā€™m still on his addon, so I havenā€™t run into any issue at the moment, but good info nonetheless!

Thanks for being brave! :slight_smile:

So Iā€™ll like export via clipboard, modify and import. This would have save you all the extra ssh steps.

The whole server piece, so you tried what indicated by install instructions and that failed and then magically, something else showed up and that worked?

I assume you had to re-add your nodes from ā€œmanage paletteā€?

Thanks again for the steps - this will help when I decide to take the leap.

Yes you could just save the flows locally but I wanted to be sure that nothing got deleted. I did have to reinstall one of my palettes but that took all of a minute. What I think I did with regard to the server was to just add a server with http://hassio/homeassistant without a password and the system filled in the appropriate api key. In the past I have had to add my own password. One thing I got hung up on was you MUST provide a credential_secret after you install and before you start it. I couldnā€™t figure this out so I made up a long string and that worked. Look at the example in the set up documents.

Good luck

1 Like

Cool! Thanks for the clarification! Appreciate it.

Hi,

Iā€™m still not entirely clear what server URL and API Password I need to be using. It was all working perfectly up until about 2 days ago where I updated both Hassio and Node-red.

Hassio Version : 0.74.2
Supervisor version : 121
node-red version 0.5
Server URL is : http://hassio/homeassistant
API Password : Usual home-assistant password
external url is : https://ha.mydomain.com:8123
Internally I can access on https://hassio.local (with certificate error due to my certificate being assigned to the external domain)

System Log is reporting this every few seconds :
18-07-26 09:09:48 WARNING (MainThread) [hassio.api.proxy] Unknown HomeAssistant API access! 18-07-26 09:09:49 WARNING (MainThread) [hassio.api.proxy] Unknown HomeAssistant API access!

Node-red log is reporting every few seconds :
26 Jul 10:10:43 - [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 clearing the API password field in node-red, but the error changed to password blank.

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ā€