Node-RED as a rule/script engine for OpenHAB

Tags: #<Tag:0x00007fae06e8b898> #<Tag:0x00007fae06e8b730>

( ) #129

One easy option to facilitate that solution is to add updates of existing packages to the nodered openHABian routine. If you agree, please open an issue in the openHABian issue tracker

(Rohnny Swennen) #130

yes makes sense. Just opened issue. Thanks !!

( ) #131

@rgerrans any chance you could join the discussion?

(Rgerrans) #132

I’ll take a look later today/this evening to see if I can help. I have the same issue with some of the default nodes (like RBE just updated) included in a regular node-red install and it’s been on my to-do list to go figure out how to update them independent of a full node-red update.

(Marcel Salein) #133

Hi all,

I found this thread while searching for a hint for my rule issue. However, node-Red looks interesting to me.
Maybe a stupid question, but I wonder how to setup it in my current installation (I’m not using openhabian).
Do I have to setup a node red installation and then install this openhab conrtribution?

Is there any tutorial to setup everything from scratch in a openhab 2 installation on ubuntu?

Thanks in advance.

BR Marcel

(Rgerrans) #134

Here you go. Here are the official docs on how to get it up and running. Feel free to throw out any questions as you get it going. -

Here is the tutorial I put together on how to replace your OH rules functionality with Node-Red equivalents:

(Marcel Salein) #135

Thanks that helped me. Installed it so far. After vacation I will try to convert my rules.

(Marcel Salein) #136


I wanted to implement the first flow. Somehow I don’t get any item in the controller node. I have checked the REST API via browser and I found and error the JSON error tells me

{"schemaValidationMessages":[{"level":"error","message":"Can't read from file"}]}

I’m on OpenHab 2.1 stable release. Do you think this is related to this? Basic UI and everything else works fine.

Thanks for your help.

BR Marcel

(Marcel Salein) #137

Ok, I found the problem. I have some items with state null. Then I have to save first my flow as described here. Now I can select items. :slight_smile:

(Jon Sands) #138

@rgerrans just updated my node-red modules and my OH2 install and it broke the openhab 2 write node. the read nodes are working fine.

The write nodes that were working fine before now report “request error ‘Error: Argument error, options.body.’ on ‘’” and they’ve made all the other nodes in my flow start acting all wonky until I deleted them

When I visit the above rest URL it displays “NULL” as expected as the item hasn’t been updated yet by Node-Red (since the write node is failing). I thought it might be a bug trying to write to items with a state of NULL, but I also tested writing to items with a state such as a number, still getting same error.

Did the OH2 REST interface change or something? my phone apps using the rest API are still working fine

OH2 version: 2.2.0-SNAPSHOT Build #1072

(Rgerrans) #139

Unfortunately, I don’t think I can be of much help. I switched from the OH nodes MQTT. I had some issues back in July -

Not sure if they are similar but from my responses I think I got things to clear up with a reboot.

Otherwise, you probably need to reach out to @Peter_De_Mangelaere who developed the nodes.

(Jon Sands) #140

Oops sorry! Thought you were the dev :stuck_out_tongue: Sadly not affected by a reboot

(Peter De Mangelaere) #141

I forgot to document a change in 1.0.6 : the openhab2-out node now doesn’t translate the input payload anymore to ‘ON’ or ‘OFF’. Maybe that explains the openhab2-out warnings.
I created a subflow with a function node containing following code and reuse it in front of several openhab2-out nodes:

switch (msg.payload)
    case 0:
    case "0":
    case false:
    case "false":
    case "FALSE":
    case "off":
    case "OFF":
        msg.payload = "OFF";
    case 1:
    case "1":
    case true:
    case "true":
    case "TRUE":
    case "on":
    case "ON":
        msg.payload = "ON";
return msg;

(Jon Sands) #142

I’m not sending on/off, I’m sending a string/number that counts up from 1. Some other nodes are sending other Strings such as electricity cost. Have you tried the out node with the latest 2.2 snapshot? I’m worried the rest API formatting changed or something, because the error in node red is “request error ‘Error: Argument error, options.body.’ on ‘’”

(Peter De Mangelaere) #143

I’m still on a release version OH2-2.1 (I don’t want to run my home automation on non-release versions).
I’ll install the 2.2 snapshot on a separate machine to run some tests.

(Jon Sands) #144

If it’s too much trouble for you to debug I can just switch to stable branch, unless others start reporting the same issue of course. I initially only meant to use the snapshot branch while oh2 was just coming out, but by now all the features I need are in stable

(Peter De Mangelaere) #145

Found the error and fixed it locally.
I’ll try to push an update tomorrow.
Thanks for helping me to the right spot!

(Jon Sands) #146

awesome news! Did it turn out to be some change on openhabs side?

(Peter De Mangelaere) #147

No … by fixing something else, I introduced this bug.

(Peter De Mangelaere) #148

Fixed in version 1.0.8