Rules in Paper UI with delay

Hi all,

I’m using the experimental rule builder included in Paper UI. I built several rules so far but now I got stuck for a specific scenario: I want to switch on some lights and switch them off some minutes later.

Any chance to achieve this using the gui?
Is that normal that only Javascript is available for the action type “Execute a given script” ?

Kind regards,
Steven

The Experimental Rule Builder is not complete (hence the experimental designation). There are a number of things not yet possible.

That’s ok, I know that this feature is still under development.
Just had the hope that there’s already a feature to use a timer, which was not documented yet

Hi

I’m having reasonable success with the rules add-on for PaperUI.

Is the JavaScript script support alive yet and is there anywhere that has examples of the correct structure?

Thanks

Stuart

I believe the JS part is working though you will not have access to key features like timers and other actions.

I have no idea what the proper structure is.

1 Like

Okay.

Thanks for the clarification.

I’m not a coder, so I’ll stick to the GUI options for now. :slight_smile:

Hello,
I’m brand new to openHab and have a little less than zero experience coding in JS. I do have some mild experience in groovy. I’m coming over from SmartThings and I’ll be moving my system over as I learn.

I’m starting with the paperUI interface and exploring those features. I’ve installed the Experimental Rules Engine and understand how it works, rather simple.

Based on what you said above, we are not able to have a delay in the rule? Is it possible to do it if we write a script to be executed? For example…

First Rule:
When motion sensor changes to on, execute script…
Script sends ON command to light x.

Second rule:
When motion sensor changes to OFF, execute script…
Script delays for 30 seconds, checks for motion sensor status of OFF, then
sends commands to light x to turn off.

Is that basically how it can work in paperUI? Or am I way off base?

Thanks

You might consider looking at the JSR223 Rules Engine which lets you code Rules in Groovy among other languages.

I don’t think that the executeCommandLine Action is implemented in the Experimental Rules Engine yet so there would be no way for you to execute the script and have it wait for the script to complete.

It’s called “experimental” for a reason. It really isn’t yet up to even Alpha level yet.

Where do I find it? My searches are coming up empty handed.

I completely understand.

You can start here. Unfortunately most people use Jython instead of Groovy but you can see some examples of JSR223 at Lucid script step by step ... (Jython scripting tutorial using lucid,jsr223 Jython helper library) and Easy Groovy Rules (long).

2 Likes