Do not work for me, I get this warning in Node-RED
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
Here’s how I finally got the Node Red Add-On working:
Create a snapshot in case something goes wrong.
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
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.
Update and save those 3 passwords in Node-Red Configuration and reboot the Host (Supervisor - System - Host)
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:
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.
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
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.
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.
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
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.
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…
Unfortunately not. I did not get any response to my question. And was to busy to try my luck on Discord or open a github issue on the addon repo.
For now I’m going with the blunt restart Node-RED addon via a Home Assistant Service call.
However would be much better just to restart the one flow that fails.
@kslb My issue also stems from modbus communication failing and freezing the modbus-flex-getter’s
internal state machine, there is no way to reset the state machine other than changing a setting in de Modbus Client config node (even just togling logging on and off will reset the state on deployment), flowrestart or addon restart will work as well, but seems an excessive measure just to reset a node.
My modbus reads are every 30s, so I should get a response back every 30s, I trigger a delay node that triggers on the read request, that I reset when the response gets back. When the the respons does not come the delay fires and I restart the Node-RED addon with a hassio.addon_restart service call.