Lightrules with nodered and active lights

Hi,

another “problem” I still have:

I’m creating a few lights control rules right now.
But if I create now a rule, which is to reach in the morning, and the lamp which is to be switched on in the morning when deploying is active, this is switched off, since this rule is not currently “true”.

Can I solve this with a RBE node?

I created something here:

[{"id":"7d7eb6f7.ebcf6","type":"openhab2-in","z":"5fb544a8.383a7c","name":"","controller":"ce8959a.db84d28","itemname":"Stube_Bewegungsmelder_Motion","x":215,"y":101,"wires":[["f3e10da1.278b6"],[]]},{"id":"4e4e4264.9a7e14","type":"bigtimer","z":"5fb544a8.383a7c","outtopic":"0","outpayload1":"true","outpayload2":"false","name":"Morgens Flur Lampe","lat":"53.3056","lon":"7.7512","starttime":"345","endtime":"480","startoff":"+5","endoff":"0","offs":0,"outtext1":"","outtext2":"","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":"","month6":"","d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":"","w6":"","xday1":"0","xmonth1":"0","xday2":"0","xmonth2":"0","xday3":"0","xmonth3":"0","xday4":"0","xmonth4":"0","xday5":"0","xmonth5":"0","xday6":"","xmonth6":"","xd1":"0","xw1":"0","xd2":"0","xw2":"0","xd3":"0","xw3":"0","xd4":"0","xw4":"0","xd5":"0","xw5":"0","xd6":"","xw6":"","suspend":false,"random":false,"repeat":false,"atstart":true,"odd":false,"even":false,"x":192,"y":203,"wires":[["582782c3.8574ac"],[],[]]},{"id":"f3e10da1.278b6","type":"change","z":"5fb544a8.383a7c","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"motion","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"ON","fromt":"str","to":"true","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"OFF","fromt":"str","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":492,"y":94,"wires":[["582782c3.8574ac"]]},{"id":"582782c3.8574ac","type":"BooleanLogic","z":"5fb544a8.383a7c","name":"","operation":"AND","inputCount":2,"topic":"result","x":570,"y":206,"wires":[["6a8d8aa7.625204","29060308.db358c","bcd593e0.a5aed"]]},{"id":"6a8d8aa7.625204","type":"BDebug","z":"5fb544a8.383a7c","name":"Debug","x":753,"y":45,"wires":[]},{"id":"b14b5976.0b9ec8","type":"debug","z":"5fb544a8.383a7c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":985,"y":103,"wires":[]},{"id":"29060308.db358c","type":"change","z":"5fb544a8.383a7c","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"ON","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"false","fromt":"bool","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":789,"y":206,"wires":[["b14b5976.0b9ec8","cde339a3.d7c2e8"]]},{"id":"dd27dce.ea7482","type":"openhab2-out","z":"5fb544a8.383a7c","name":"","controller":"ce8959a.db84d28","itemname":"Stube_HM_kleine_Lampe_State","topic":"ItemCommand","payload":"","x":1122,"y":206,"wires":[[]]},{"id":"bcd593e0.a5aed","type":"debug","z":"5fb544a8.383a7c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":750,"y":106,"wires":[]},{"id":"cde339a3.d7c2e8","type":"rbe","z":"5fb544a8.383a7c","name":"","func":"rbei","gap":"","start":"","inout":"out","property":"payload","x":924,"y":289,"wires":[["dd27dce.ea7482","a8a4c770.54c118"]]},{"id":"a8a4c770.54c118","type":"debug","z":"5fb544a8.383a7c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1139,"y":296,"wires":[]},{"id":"ce8959a.db84d28","type":"openhab2-controller","z":"","name":"openhab2","protocol":"http","host":"localhost","port":"8080","path":"","username":"","password":""}]

Regards
Hermann

These boolean logic node do not work…
You need to use a flow variable or global variable:

https://nodered.org/docs/writing-functions#storing-data

Why does the Boolean Node not work?
At least the light came on this morning :slight_smile:

They do… But node-red works asynchonously and these nodes store info. They may not have that info all the time.
And think that’ is where your problem came from in the first time.
node-red is really poor with persisted values and it has to be done programaticaly with flow variable or global variable.
I use node-red, I think it’s great. But when is come to having to compare item states and more complicated rules, I do that in openHAB because it become more complicated to do that in node-red than a few lines of code in openHAB.

Ok, thanks for your explanation. If several values are to be monitored, it is a bit confusing in Node-Red - but that’s how I have everything in one place.

I’ll keep trying in Node-Red.

Thank you.