Home Assistant Community Add-on: Node-RED

configured credential_secret under supervisor > add-on > node-red > configuration

restarted HA, no warning secret warning

Do not work for me, I get this warning in Node-RED

image

And the log states

7 Mar 10:34:23 - [warn] Error loading credentials: SyntaxError: Unexpected token ďż˝ in JSON at position 0
7 Mar 10:34:23 - [warn] Error loading flows: Error: Failed to decrypt credentials

Do you know how to get the add-on safe @frenck?

Here’s how I finally got the Node Red Add-On working:

  1. Create a snapshot in case something goes wrong.
  2. There are 3 ‘passwords’ used by the Add-On under Supervisor - Add-On - Node-Red - Configuration:
    a) credential_secret
    b) http_node password
    c) http_static password
  3. Manually check each of those 3 directly at the Have I Been Pwned web page. Make sure there are no ‘hits’ on the passwords and try variants until they show no hits.
  4. Update and save those 3 passwords in Node-Red Configuration and reboot the Host (Supervisor - System - Host)
  5. If you’re using secrets.yaml, move the 3 passwords out of Node-Red Configuration and into the secrets file.

Additional comments:

  • I don’t know if rebooting the host is necessary, but in many attempts to fix this issue I believe I had tried to just restart the Node-Red Add-On and restart HA without success.
  • Not sure if it was Node-Red or another Add-On, but at one point I received a “Check Configuration” error that indicated it didn’t like one of my passwords that started with an !exclamation, so I had to change that to something else.
  • Right now when I try to check a password at the Pwned web page it just spins for a while and eventually throws the following error: " Oh no - catastrophic failure!". I don’t know if the API side of that web site is still functional, but if so it may be affecting people when they are trying to resolve this.

Thanks for the info, I tried al that and restarted the host, the supervisor, the machine, HA but still get the error that “Credentials could not be decrypted. The flow credential file is encrypted, but the project’s encryption key is missing or invalid.” Did you get the same at first?

Yes, same error. The only other thing I did was to disable my mqtt-broker since I had only used that for testing once and no longer use it (In Node-Red - click the 3 config bars at upper-right - Configuration Nodes - double-click mqtt-broker). That node does have an SSL option as well as a username/password option on the Security tab. Not sure if that password was also being checked against HIBP site.

If you change credential_secret in the add-on config you are going to get this error. All credentials collected as part of configuration of nodes in Node RED are stored in an encrypted file. This file is encrypted with the value you put in credential_secret. If you change it then that file can’t be decrypted like the error says, that’s why the add-on says not to change it.

If you do want to change it you have two options:

  1. Restart after changing it and fix any broken nodes. Most likely there’s a few configuration nodes you’ll have to fix and everything else will be happy again but depends on the complexity of your Node RED situation.
  2. Give this experimental solution Kermit posted a try. I would definitely make a backup first although realistically the worst that happens is you end up back at #1
1 Like

Can anyone help out for a normal HA user (not hass.io)?
I have installed Node Red through the HACS (not the addon store, that does not exist natively in HA). After install I added the Node Red Integration but there’s no config anywhere and nothing in the sidebar.

I’m trying to access the Node-Red api.
I’m on

OS: Home Assistant OS 5.12
Supervisor: supervisor-2021.03.6
Core: core-2021.3.4
Node-Red Community Addon: 8.2.0

The Node-Red docs tell me to add a user and hashed password to the adminAuth object in settings.js.
The /config/node-red/settings.js file mentions the adminAuth object is controlled by the addon and removed. it further states ‘known as users in the add-on configuration’.

First hurdle was the actual url of api to get the token. All Node-Red docs mention http://localhost:1880/auth/token however this url get me a Status code 500: Internal Server Error.
Some digging around I read that the url from the Node-Red docs probably end up in the Home Assistant server and for urls to an addon I should add /endpoint to the url.
So I think the url should be http://localhost:1880/endpoint/auth/token. On this I get a Status code 401: Unauthorized.

I don’t know what username or password I can use to access the api. I tried the http_static and http_node users, Home Assistant users, and even (against all odds) tried to add the adminAuth object to the settings.js file anyways, but to no avail. Everytime I get the unautorized result.

My question is, how to access the Node Red api when using the Node Red addon?

This is not nodered, this is only intergration for nodered so you can integrate Nodered to HA. Nodered can create sensors and other stuff in HA with this integration. You still need nodered addon or nodered container.

2 Likes

Took me a while to get to this point, thanks !

Good time of day
I have the same problem
2 Apr 14:43:42 - Error: bind EADDRINUSE 0.0.0.0:9898
at dgram.js:337:20
at processTicksAndRejections (internal/process/task_queues.js:81:21)

Do You have resolved your question?
How can I change the port?
Thanks

I just updated node-red to the latest version and I am getting the following error:

Error loading settings file: /etc/node-red/config.js

If I rename my old folder and restart the addon it creates a new folder and it works, but as soon as I copy most of my config files to the new folder I get the same error.
By the way, that file doesn’t exist, or at least it doesn’t appear on VSCode. But it doesn’t exist on the new folder that was working either, so I don’t know what this error refers to

I don’t know what happened, but after a couple of restarts it started working. Why? Not sure, because all I did was enter the docker container and I opened the settings file with vim, didn’t changed it at all and after that it worked. :exploding_head:

It takes a little time for node-red to start after HA has started. You probably just didn’t wait long enough.

My node red was not taking time to start, it was starting and failing.

Can you please share node-red flow … I have a little problem to make a flow and importing flow would solve my creation of flow problem…

thank you…

It is a comment from 2018, ALOT have happend since then. All the community add-ons have a watchdog toggle that restart the add-on if I freezes up. So that should fix it, I myself have deleted my watchdog flow a long time ago.

I agree… but in case that modbus freeze (happened before) no watchdog is helping… Node-Red do not know that modbus protocol failed… I need to procedure so that HA can restart Node-Red in case that my binary sensor is static for more that 300 seconds…

Hi –

Did you find a solution for this? I’m having the same issue.

I try to access https://server.local:1880/endpoint and get a http basic auth prompt.