Nodered error after moving to openHAB3

I upgraded to Openhab3-M5 from Openhab2 on a Rpi-4. My deamon.log is filling up with:

Dec 12 10:14:45 openhab Node-RED[371]: 12 Dec 10:14:45 - [warn] [openhab2-controller:Openhab] ERROR {“type”:{“errno”:“ECONNREFUSED”,“code”:“ECONNREFUSED”,“syscall”:“connect”,“address”:“127.0.0.1”,“port”:8080}}

I get an error every second.

I’m not really using nodered. I enabled it under OH2 to play with it a bit.

How do I resolve this?

openHAB3 requires authentication for the REST API. It also has Blockly which is similar to NodeRed.

I am not sure what the options are on NodeRed. You can either generate an API Token or turn on Basic Auth for the API.

Bruce. Thanks. I really just want to get rid of it. I killed the nodered process. That stopped the log messages. After I killed it, I saw it was controlled by systemd:

Dec 12 13:51:49 openhab systemd[1]: nodered.service: Main process exited, code=killed, status=15/TERM
Dec 12 13:51:49 openhab systemd[1]: nodered.service: Succeeded.

Hopefully this takes care of it:

systemctl disable nodered.service
Removed /etc/systemd/system/multi-user.target.wants/nodered.service.

Thanks,

Andy

To be sure you may want to systemctl stop nodered

As a nodered contributor/ dev myself I just want to clarify this is not true at all. Those a very different tools. Blockly is putting together JavaScript Code blocks in a graphical way, no more and no less. Nodered is actually a whole eco system of its own based around integrations of thousands of different things connectable in a low code way based on javascript / node.js and that is not unlike the openhab binding model. There is also a Blockly contrib in nodered itself actually.

That is unfortunately the only way right now as none of the openhab nodered nodes have been updated yet fo be compatible with the new authentication of the rest api. Most probably this will happen soon though.

Hopefully you’ll come back to it one day. Its a very powerful tool with one of the nicest most helpful communities surrounding it.

If you really want to delete it you would also have to uninstall it via npm.

1 Like

I may later, once I get my head around OH3 and work out a few issues. My last experience with it was shortly after I first started with OH2. It was interesting, but learning OH itself was all consuming at the time. :slight_smile:

Sorry I just knew they are both graphical ways of expressing rules.

1 Like

@JGKK
Set Basis Auth for the API fixed the issue for openhab2-in nodes. So I’m receiving values from OH3 properly. But I still have problems sending commands with openhab2-out nodes🤔.
Any ideas how to fix it? I’m strongly depend on my node-red rules but also don’t want downgrade back to oh2.

Best open a github issue on the github page of the openhab nodes so that the node authors can look at this.
I actually left openhab with the move to openhab3 and migrated everything to nodered so I can’t have a look myself.

Update to node-red-contrib-openhab2 1.1.8 did the job.:grin:

3 Likes

Was kind of shocked that it it not work out of the box.
This hint solved my day.
I am a heavy user of the combination openhab, nodered together with piVCUU; all on one rpi
openhab together with nodered is a great combination.

I’m also a heavy openhab/node-red user. I’ve migrated all my oh-rules to node-red.
But since openhab3 migration the openhab2-get node becomes very slow. It takes ca. 2sec to get values from openhab3. So even short rules may take up 10sec to execute. Bad for e.g. motion detection.

I’ve created an issue on git:

I would be glad to get some hints for a solution here.

found the right hint here. Now node-red runs again like a charm. :partying_face:

for me, I’m seeing
Unauthorized API request: Invalid Basic authentication credentials
each time nodered does a request, but I have the data in nodered… I don’t get it. I did generate an api key and enable basic auth

@Nodiaque: Use api token and basic auth. Update all palletes, restart nodered.service. After that everything works.

How do you use the api token?

How to generate an API token

Sign in to OpenHAB with your administrator username and password by clicking on the bottom left icon in your dashboard.

After signing in, click again on the profile button to access your profile page.
Click on Create new API token.

Use your admin username and password, fill in the token name (e.g. choose a name to remember the service you created the token for) and a Token Scope (optional)


Now the token is created. Please copy the full token now.
image
This token is in the used service your username, leave the password empty.
As example, below in NodeRed configuration the generated token is used as username.
image

1 Like

Hello, I have migrated to OH3 and I can’t get correct item state on NodeRed, sometimes is NULL and sometimes just stack on the state that it was when I started Nodered even I if change item state.
image
Although it can clearly read the items


I’m using API Token to connect and palette node-red-contrib-openhab3 1.3.4.
Where can I find logs about this?

Thanks

I am using node-red-contrib-openhab2 version 1.1.8 which is compatible with openHAB3. Version 1.1.7 is only compatible with openHAB2.5. The REST API changed from openHAB2 to openHAB3. This works on my setup when defining an access token in openHAB3.

You are using a different package, node-red-contrib-openhab3 which seems to be less maintained in time.

Hello Olivier,
Thanks for your reply, most probably there was something wrong with my nodered installation or setup. I delete the docker, setup everything from the beginning and it worked like a charm. Using node-red-contrib-openhab3 package.