Openhab 3 - rules / scripts

Hi I created a small scrippt for testing because other scripts are also not running.

if i want to test it i get the following answer in the console:

can anybody explaneto me what I’m doing wrong ?

You have to define the trigger in the ui when creating the rule. The script is only the part between then and end.

what do ypu mean with trigger ? a rule ?

Scripts are only meant to run without a trigger. in your case, just the part between when and end.
What you need is a rule.


In the MainUI you give a trigger (the when part) and then you give as action a script. There you can put just the part between when and end in. Then it should work.

OK thanks, understood.
So this means Openhab 3, i can not use my old rules ?

Unbenannt

Hi Ben. Use here Name of your Item not a Label.

No, you can use your old rules. Either by text files (as in OH2) or with the MainUI. The only difference is that the when part is set by the MainUI instead of coded in your rule.
So in the MainUI you give as trigger newPerecentValueWhonzimmerFernseher changed and in the action part, you select script/DSL and past Arbeitszimmer Licht.sendCommand(OFF) (the item is not correct, as @Silver8000 said!)
or you select as action Item action and pick in the UI your item and select the action send command to and fill in OFF

Can anybody explain what is script tab for? I was on same point. I know that i can rules and DSL to create rules. But what can we do with script tab?

Script tab is used for rules (dsl, JavaScript, python) without any triggers, to run manually.

1 Like

Hello,
to this thread, I also have some questions of understanding.
at this time I use openhab 2.5 and take a look at openhab 3 on a Mirrorsystem.

In Openhab 3 the rules are the trigger for starting a script?
When I make rules under the menu item “Scripts”, they are not automatically executed ?
What are the scripts under the menu item scripts used for?

Thank you to all. Actually I didn’t understand how to use the “script pad” to attach my old rules.
If I understand, the only difference is I cannot paste all the rule but I have to select the trigger on the gui and “than” I can past the other part of my dsl rules.
I read somwhere if I use the gui, the rule will be faster or lighter than the textual file. Is it right?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.