Node-RED as Alternative Rule Engine

Hi,
The json is SI7021.

So the change node should be

msg.payload.SI7021.Temperature

I’ll check when I get home but it should work.

See below
It works:

image

With the json: {“Time”:“2018-03-05T19:58:33”,“SI7021”:{“Temperature”:17.7,“Humidity”:44.7},“TempUnit”:“C”}

and the node:

image

Hi,
can you elaborate what the current state is?
I tried to look it up on github but do not understand what is going on.

The current state is that’s I’ve added the features described, and that it’s working for me. The original nodered plugin creator would rather keep the plugin as simple as possible and it was suggested that I could make use of subflows to reach the same, so a PR was not accepted/created. However, I’m using my adapted version on the nodered openhab2 plugin with success. I think it makes more sense to you when you look at the branch that contains my changes: add-openhab2-in2-node.

I’m running nodered in docker and have copied my version of the nodered openhab2 plugin over the original one. If you don’t know how to install/use a custom nodered plugin that is not in the library, I suggest you do not use it and stick with the original one, maybe extend it with subflows.

Hi - I am new here , and experimenting with a fresh OH2.2 on Raspberry Pi 3 B+, binding through Z-Wave + RFXCOM USB Transceiver.
In the introduction of this topic, I read:

As of OpenHabian v1.3 286, node-red is now part of the standard package.

My question: Have I overlooked Node-RED in OH2.2 (where I did activate the experimental rule module)? If not, are there good reasons (not) to install & start using it?

Many thanks! Peter

It’s available as a standard component of the Openhabian package but not Openhab itself.

In openhabian you are able to install install it through the Openhabian-gui command as an “additional component” where as with a regular OH install you need to take care of installation yourself.

1 Like

Hi @snoekieboe. I checked on my Openhabian, and couldn’t find “node-red” as a standard additional component. I found (and activated yet earlier) a rules scriptor. But that is still to create scripted rules (name + description) as text commands format “when… then… but only if…” . I would have guessed that node-red is a graphical editor?

in openhabian config (sudo openhabian-config)

Select " Optional Components" (item 20)

Select " Node-Red" (item 25)

Once installed visit “http://ipaddress:1880” to open the nodered graphical interface

hope this helps :stuck_out_tongue:

Br

Snoekieboe

2 Likes

I’m trying to set the value received (e.g. 58 in this case) by Openhab Dimmer Level node into a JSON object in the Set function. The payload from Dimmer Level shall replace the fixed value of 80 in the data.level variable.

The data structure shall be as shown in the JSON object.

The JSON object is then sent to dimmer actuator.

How can I replace the fixed value of 80 in the “level” with the variable from Dimmer Level item?

Have you tried to replace the 80 by msg.payload?
If that doesn’t work you will need a function node

The function node did the trick.

var dim_level = Number(msg.payload);

msg.topic = "1.103"
msg.payload = {  
      code: 49,
      data: {
        channel: 6,
        level: dim_level
      }
   }

return msg;

Hi,
should I install Node-Red as root?

No!
Follow the installation instructions in the node-red website

The openhabian-config wants to install as root so I am slightly confused. I had the same question as @gm2066.

If that’s what openhabian wants to do let openhabian do that.
It’s a custom os for OH.

Yep! Thats what it wanted, so I did it. Its all working, but the warning was quite interesting in my book. I would like the openhab-config to not ask and just do it.

Enjoy node-red. Great tool to add things that are hard to do in OH but very easy in node-red.
There are nodes for openhab2 which I recommend.

1 Like

@rgerrans can you give an example how i can use your Time of Day check to turn on a light if evening?

With node-red or openHAB?

node-red