Home Assistant Community Add-on: Node-RED

Hi all

to load an npm_package in which folder should I save the file?

File is not on Github, it’s on a HTTPS website or I can download it locally.

Thanks

EDIT:
Solved, placed in /config/node-red/node-modules

@frenck I can confirm that in a new installation the Node Red Dashboard is accessible with direct access on port 1880, no strange login loops whatsoever… now I need to understand what’s happened on my main install… I’ll try to reinstall the plugin or the dashboard nodes and I’ll let you know.
Thanks for all your efforts and releases.

If on chrome, try it in incognito mode, if that works, empty ALL your cache.

I’ve already tried that with no luck, it happens even in Firefox, where I never opened the HA page before… I didn’t try again but I’ll do some other tests soon… I don’t currently use the node red dashboard cause I preferred to create a more reliable integration using a Lovelace custom card, and then connecting the inputs and all the stuff using the node red HA status nodes, I’m just trying to solve the issue for any future usage…

I am running into the same issue as some others when accessing the Node-Red dashboard. When attempting to load https://myip:1880/ui I get a login loop. The main Node-Red ui works fine. It asks once for a user/pass and then loads as expected. I have tried clearing cache, Frenk’s fix and using incognito mode and nothing works.

1 Like

Hi

Someone can assist here:

Thanks for the pointer.
It would be wonderful if ingress config for this addon can support both the configuration UI (httpNodeRoot) and the dashboard ui (httpNodeRoot/ui) endpoints.
There are some very very nice nodered dashboards that can really complement HA UI.
(https://flows.nodered.org/flow/1f1c0dde4ff193e5c14d5b99442a7d00)
Please can you consider this as an enhancement for the addon?
(I can raise it somewhere if you prefer to manage such requests elsewhere?)

17 Apr 12:25:21 - [error] [server-state-changed:8b2a5b15.0e3fe8] TypeError: Cannot read property 'addListener' of undefined

I had this happen to me back in April too I googled and searched forum and thought I was the only one so I started a post. The fix was the same for revert back to previous snapshot.

Problem now is I just moved my HA from my RPi which was getting too slow and migrated it to a VM and now the area has returned. I reckon it’s something to do with permissions between Node Red and Home assistant and the permission entry is stored in HA somewhere not in Node Red which is why nuking node red from the system and reinstalling it does not fix it as the old key still exists and doesn’t get replaced.

Ideally for quick fix I revert back to and old HA snapshot but I can’t go back to an older snapshot because they were all created on the RPi and as part of the transition to the VM I already did a wipe and restore of the working version from the RPi.

So at the moment I’m stuck :face_with_head_bandage:

At this moment I don’t have any problems anymore. I’m running on the latest versions of NodeRed (3.0.3) and Hassio 0.92.2.

Because NodeRed has (working) ingress now, I had to remove the NodeRed instance of panel_iframe from the configuration.yaml file.

In the NodeRed addon settings I activated the switch “show in sidebar”. This is my config:

{
  "credential_secret": "secret stuff1",
  "dark_mode": false,
  "http_node": {
"username": "secret stuff2",
"password": "secret stuff1"
  },
  "http_static": {
"username": "secret stuff2",
"password": "secret stuff1"
  },
  "ssl": true,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "require_ssl": true,
  "system_packages": [],
  "npm_packages": [],
  "init_commands": [],
  "log_level": "info",
  "port": 1880
}

If you’re using Chrome browser, right click within the Hassio interface and click “inspect element”. Under the “Application” tab, delete every local/session storage and the cache. Try also emptying the browser cache etc. Do this of course after updating to the latest versions.

I happen to be also running hassio on a VM, so we might have a similar setup. Tell me if you need more information and I’ll do my best to help you.

1 Like

Yeah all those login problems were sorted out with the 3.0.3 update.

The problem I have/had was I after I migrated from my RPi to VirtualBox VM where I had the cannot read property for all my devices. Like you had on the 17th April and I had on the 24th April

Apr 12:25:21 - [error] [server-state-changed:8b2a5b15.0e3fe8] TypeError: Cannot read property 'addListener' of undefined

The short of it:
You can only use the first password you entered in the “credential_secret” in your node red settings, if changed the password you have to revert back the old one and reboot.

The detailed version

The root cause of the issue lies with the “credential_secret” which once you enter it for the first time save and restart node red it encrypts you workflows with that password and that password alone.

You won’t run into any difficulties until you do something big that causes node red to requery the password found in your credentials file against the encrypted key in config/node-red/flows_cred.json in which case they won’t match and Node-red won’t be able to access your flows to execute them.

What I noticed from my backups is the encryption in the file config/node-red/flows_cred.json changes even though I only changed my password once. I am guessing it could have something to do with when you deploy your flows.

The trick I found was to put my original password I created (thank you lastpass for keeping histories) in the config of the node red addon. I then went into my snapshots and into the config/node-red/flows_cred.json file starting with newest and working backwards until the encryption key I used didn’t produce the errors and this meant I didn’t have to lose anything in home assistant via full restore.

I have seen this type of thing mentioned around by @frenck (an admin) and by the developer on the node red forum although they did not specifically target this issue it was enough to get me on the right track and hopefully anyone else that comes across the same issue (where you changed your credential key not knowing you only get one shot at creating it and comes back to haunt you).

Hello

I also have got the same login loop problem ! :frowning: I have the latest Node Red and Hassio installed. Someone can give me some step-by-step instructions to get the dashboard back, please ?! I will loose all of my hair very soon ! :slight_smile:
Thanks a lot in advance

If you could provide node red log (at the bottom of the node red addon) and maybe HA log (last icon on the right under developer tools) the problem is probably logged in either one of these if you post here one of us might be able to pick out what the error is and point you in the right direction.

ps remember to use 3 of these ``` badboys above and below your each log/code paste which puts keeps it in code format.

Hello

Here it is the the node red log "
[16/May/2019:11:31:17 +0200] 401 -(192.168.130.58) GET /ui HTTP/2.0 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0)
[16/May/2019:11:31:40 +0200] 401 -(192.168.130.58) GET /ui HTTP/2.0 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0)
[16/May/2019:11:31:47 +0200] 401 -(192.168.130.58) GET /favicon.ico HTTP/2.0 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0)

"

I don’t know what the 401 means after the date and time maybe a line number but the rest of that is just saying your computer which has an IP address of 192.168.130.58 browser Firefox version 66 is making a request which is just basic info. This is not the log data we need.

To get the startup code flow where is most likely where the error will be hiding restart your Node red addon and then keep clicking the refresh in the log and you will see node red going through the loading process when it stops loading say up to 5 mins then copy and paste the log again.

ps the character for getting code format is not the quotation marks " it is three back ticks ` together, on my keyboard (qwerty US) it is at the top left of the keyboard to the left of the number 1 (you can see under point 11 here)

For the 401 isn’t it the 401 Unauthorized code?

Yer I thought of that after. I was going to see if he came back with more log data and then go from there.

1 Like

Hello

Thanks for your patience ! There is nothing suspicious in the NR logs, just some unconfigured node.
Just when I try to login I have the same log entry.

16 May 15:34:48 - [info] [server:Home Assistant] WebSocket Connected to http://hassio/homeassistant
**16 May 15:34:48** - [error] [function:Generate list] TypeError: Cannot read property 'length' of undefined
**[16/May/2019:15:36:53 +0200]** 401 -(192.168.130.58) GET / HTTP/2.0 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0)
[16/May/2019:15:37:05 +0200] 401 -(192.168.130.58) GET / HTTP/2.0 (Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0)

What I noticed in the log anyway, is the different time format, maybe that is the problem. Any thoughts ?

Thanks again.

:tada: Release v3.1.0

Full Changelog

:tada: A packed Node-RED, with a bunch of package & system updates, including the Home Assistant Websocket node.

:sparkles:Node-RED Dashboard (UI) is now shipped by this add-on by default and has been patched to work better with Ingress.

:ambulance: The issue with ARM 64-bits is resolved. Which mean that the aarch64 architecture now also works.

:ambulance: The issue with accessing HTTP nodes has been addressed. HTTP endpoints are now freely available when using the /endpoint/ URL prefix. Please take that into account when using this.

:wrench: Direct access is now enabled by default. This is needed for HTTP nodes and Node-RED Dashboard as well.

:hammer: Changes

  • :arrow_up: Upgrades python to 2.7.16-r1
  • :arrow_up: Upgrades lua-resty-http to 0.13-r0
  • :arrow_up: Upgrades nginx to 1.14.2-r1
  • :arrow_up: Upgrades nginx-mod-http-lua to 1.14.2-r1
  • :arrow_up: Updates node-red-contrib-home-assistant-websocket to v0.11.0 (#219)
  • :ambulance: Turns of Lua Resty core in Nginx
  • :arrow_up: Updates node-red-node-serialport to v0.8.3 (#220)
  • :wrench: Adds configuration to allow http_node access (#214)
  • :sparkles: Adds Node-RED Dashboard
  • :ambulance: Allow for bigger file uploads during import
  • :warning:Adds warning to logout when using the Dark theme
  • :books:Adds known issues and limitation section to documentation
  • :rotating_light:Patches Denial of Service vulnerability in Axios package (#221)
  • :pushpin: Pin snyk to 1.165.1 (#222)

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

Great job… love this addon!
Only started using it recently and almost converted all my automations to node-red.

Thanks :beers:

Thank you for creating this amazing add-on. I’m interested in using !secret for the add-on config but don’t know how. For e.g. should I just use: “credential_secret”: “!secret node_red_crediential”

Also, I experienced the 502 Bad gate way with the following config and there’s no error in the log.
{
“credential_secret”: “xxxxxxx”,
“dark_mode”: false,
“http_node”: {
“username”: “xxxx”,
“password”: “xxxx”
},
“http_static”: {
“username”: “xxxx”,
“password”: “xxxx”
},
“ssl”: false,
“certfile”: “fullchain.pem”,
“keyfile”: “privkey.pem”,
“require_ssl”: true,
“system_packages”: [],
“npm_packages”: [],
“init_commands”: []
}