Start a rule in a rule

I am pritty new with openHAB so I am learning so many thx to the community otherwise I would not have started with openHAB (learningcurve)…

Could be that my solution is somewhere on the Community Blog but I did not find it. Sorry if it is.

I have made a rule that for exaple dims my bedroom lights “original rule”.
I want to use this rule in “another rule”.
Now I copy paste the “original rule” in “another rule” but if I change something in the “original rule” I have to remember to copy paste it in the “another rule”.
Is there a way to start “original rule” in “another rule”?

Many thanks

The most obvious way (for me) would be to make use of a proxy item, which changes when your original rule is running.


rule "original rule"
When "original trigger" changed
proxy_item.postUpdate (ON). 

And in your secondary rule you´ll be using:

rule "secondary rule"
When proxy_item changed
<whatever your secondary rule is doing>

There may be better ways to do this. And I havn´t tested it myself. But I dont see why it shouldn´t work.

Thx Tom for your quick reaction!
But for example I use this Progressive Dimmer rule as a wake up dimmer.

But I have changed/added some things (the dimLevel to 90 instead of 100).
I have made another rule to do the same when I trigger a switch.
But now I would rather have de dimLevel to 70 so I have to change it twice.
Is there a way to make a “standard rule” to dim the lights and refer to it in another rule?

to be clear I want this part as the standard rule

if (timer === null) {
    timer = createTimer(now.plusSeconds(0), [ |   //Starts immediately
        if (dimLevel == 100) {
            timer = null // cancel timer
        } else {
            dimLevel = dimLevel + 1
            timer.reschedule(now.plusMillis(timeoutMills)) // reschedule timer is 3 * 600 mills

There are several approaches. Which one is best depends on the context.

How about group your items and use the “Member of” trigger?
Within the rule refer to triggeringItem.

The new rule engine allows for you to execute a rule’s action from another rule’s action. This can be done in rules created through the UI or scripted automation. Actually, you can create just actions without triggers, so not a full rule, and execute those from rules.

thx all, still figuring out what to use for what…