Node-RED as Alternative Rule Engine

rules
node-red
Tags: #<Tag:0x00007fd313a574c0> #<Tag:0x00007fd313a57240>

(Vincent Regaud) #101

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.


(Vincent Regaud) #102

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


(Sebastian) #103

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.


(Randomname) #104

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.


(Peter) #106

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


(Roel) #107

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.


(Peter) #108

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?


(Roel) #109

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


(Bent) #110

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?


(Vincent Regaud) #111

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


(Bent) #112

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;

(Grzech) #113

Hi,
should I install Node-Red as root?


(Vincent Regaud) #114

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


(Danny mullen) #115

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


(Vincent Regaud) #116

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


(Danny mullen) #117

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.


(Vincent Regaud) #118

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.


(Jompa68) #119

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


(Vincent Regaud) #120

With node-red or openHAB?


(Jompa68) #121

node-red