How to execute an existing rule?

I wasn't sure where to write this question since we have different types of rules but anyway here is my question:

How can I execute an existing rule from another rule? Is there a way to do that?

Thank you

You can do this in Rule Machine. As an action, you can "Run Rule Actions". Select that and then select the Rule whose actions you wish to be executed.


Thanks aaiyar,

I was able to create a rule in Rule Machine without a trigger and I am reusing the same piece of code for 3 other rules. So far the rules that calls this rule (first screenshot below) is working great but I have to see if the delay runs fine after it doesn't detect any moment from my motion sensor on my second rule (see second screenshot). Any time it detects movement it delays 30 minutes for the light to turn off automatically.

Do you know if there is a way to see how much time left is on the delay?

Also, do you know if a new delay is created every time motion is detected per my code below and if a new delay will overwrite the previous one?


With your second rule every time it detects motion the rule will run another instance. A delay does not get interrupted unless you make it cancelable. If you make it cancelable then each time a new trigger is detected the rule is halted and restarted. The way your rule is now on every motion detect the first rule will be ran.

I generally use a wait, they by default the rule gets interrupted on a new trigger.


You can look at the rule's Scheduled Jobs and see when the Delay is scheduled to end. The way your rule is currently written, you'll see Scheduled Jobs stacking up every time the motion sensor goes active. If you make the Delay cancelable, or use a Wait as suggested, you'll see the Scheduled Jobs get updated instead. If you're not sure how to see the Scheduled Jobs, select the gear icon in the upper right corner and scroll to the bottom of the page.
For testing purposes I'd suggest changing the Delay (or Wait) to something shorter like 2 minutes until you understand how the rule behaves.


Thank you terminal3 and pseudonym for your feedback. I have added cancelable per your suggestion. See code below:

As for the WAIT approach, which one of these 2 would I need to use?

I forgot to ask if there if any fundamental difference between the use of Delay and Wait?

You also need to add Cancel Delayed Actions to your rule, probably as the first action but definitely before the Delay.

For the Wait you'd use Wait for Events then select Elapsed Time.

Functionally, cancelable Delays and Waits are similiar. Waits are automatically canceled when a rule triggers (or re-triggers). Cancelable Delays need to have the Cancel Delayed Actions called. You could put a Cancel Delayed Actions within an IF-THEN and not cancel a Delay based upon a condition so I would say it give you more flexibility but I've never had a need for that functionality.

Edit: Don't put a Delay within an IF-THEN. You'll get a "Multiple simultaneous rule execution error" if the rule is triggered multiple times while the delay is pending.

I got lost on having to put a delay at the beginning of the rule but I think I know what you mean. Even though I put the cancelable delay before turning off the garage lights (see first screenshot below) there were more instances/threads of the same rule being created every time I walked by the sensor (see second screenshot below). I went ahead and tried the Wait command (see third screenshot below) and that seems to solve 2 issues, it cancels any other instance/thread of the rule and I just see one instance created with the correct Next Run Time, also it solves the problem having to put a condition at the beginning of the rule, at least that's how I can see this is working (see fourth screenshot below).

Thank you

Delay cancelable identifies a delay that can be canceled. Cancel Delayed Actions is the action that will actually cancel those Delays. Put together, the rule should look like this.

Select Trigger Events
Garage Motion Sensor motion active

Select Actions to Run
Cancel Delayed Actions
Run Actions: Turn on garage lights
Delay 0:30:00 (cancelable)
Push button 6 on Garage Entry RRD-W7B-WH
1 Like

I see now. Thanks for the explanation. So if I leave the Wait for event code shared it should work fine as well, right?

Yes, and Wait would be my preferred method.


Thank you so much