Stuck trying to get node-red working with HA

So I followed the instructions to install node-js and then used npm to install node-red. All good until it tries to connect with HA, then it fails with the error "Connection to home assistant could not be established with config: http://ipaddress:8123 ", and HA says “Login attempt or request with invalid authentication”

Trying to sort through all the many cryptic links on this topic, I think I may have installed an older version of Node Red that is no longer compatible with HA 0.92 due to deprecation of the old API key access authorization method.

As a test I tried adding an api_password to my configuration.yaml file and specifying that to Node Red. That works - the error goes away and Node Red can communicate with HA.

Is my idea correct that this is due to an outdated version of Node Red? I have Node-RED version: v0.20.5, and I selected the regular HA community version rather the LLAT or websocket version, as recommended in the tutorial I followed.

If I should update, how can I get rid of the Node Red version I installed? Installing the websocket version over it doesn’t seem to work.

Remove the Node-RED folder under your Config folder. Then restart HA. Use the newer version of Node-RED that uses the websocket. If you are using Hass.io, you can just install the Node-RED add-on and all that is set up automatically.

Hope this helps.

1 Like

The websocket one is the only one being maintained and current

Are you running hassbian?

1 Like

Running a lightweight Ubuntu server, not Raspberry Pi, so no hass.io or hassbian.

The palette you need is the websocket one.

1 Like

It appears that my mistake was installing the wrong HA palette in Node Red, misled by the out-of-date tutorial. There might have been a way to remove the HA palette and re-install the correct one, but what I did was to remove and re-install Node Red using: npm remove node-red, npm install -g --unsafe-perm node-red. I was then able to make the correct palette selection, and then specify an access token instead of an API password. That works.

You just go to the palette manager in node red and remove the installed one, and install the correct one. It’s a few clicks.

Not quite. Since I had created a flow to do an initial test, that incorrect palette was marked “In use” and could not be removed. Even after deleting everything in the flow, deploying the new empty flow, and restarting Node Red, the palette remained “In use”.

I later discovered a way to delete the link to HA, and that finally allowed the palette to be removed, but by then I had already implemented the alternative solution of removing and re-installing Node Red.

Because you have to delete the “Configuration” node.