Understanding Rule Machine

Migrating from ST and trying to wrap my head around rule machine. I have two rule sets that I have questions on...

Using RM I have two rules for my front door lights. One turns them on randomly 15 mins after Sunset and the other turns them off randomly 30 mins after 9pm. Is there a way to do this as one rule? or is the better method to do it as two rules.

The second rule set has one rule for a closet that turns on/off on contact sensor. The other rule turns it off if the door is left open for x minutes. Again is there a way to do this as one rule or better of as two?

I think I figured out the closet rule... can't post an image, but I have the following setup:
Conditions: Master Closet Door open
Define Rule: Master Closet Door open
Select Actions for True
On: Master Closet
Pending Off: Master Closet: 10 minutes
Select Actions for False
Off: Master Closet

Do I need to use pending cancellation?

You will probably use this pattern over and over.

My Front Door Rule, still stuck on if this is the best way to do it:

Turn on Rule:
Selected Trigger Events: When time is Sunset
Selected Actions:
Delay by 15 minutes [Random]
Dim: Front Door: 40
Color Temperature: Front Door: 2700

Turn off Rule:
Select Trigger Events: When time is 9:00 PM
Selected Actions:
Delay by 30 minutes [Random]
Off: Front Door

You could make it just one rule.
Select conditions.
Time is between sunset and 9:00PM.

Select actions.
Time is between sunset and 9:00PM.

Actions for true.
Delay by 15 minutes [Random]
Dim: Front Door: 40
Color Temperature: Front Door: 2700

Actions for false.
Delay by 30 minutes [Random]
Off: front door

2 Likes

This is one rule I believe.

It is good practice to leave the pending cancel in because you don't want it turn turn the light off you close, and open a couple times. Then you might get the light turning off while the door is open. I assume you want to turn the light on while the door is open but only for a max of 10 minutes, correct? You don't want it on forever if you leave the front door open, correct?

There are two different rules, I probably should have made two posts.

The first is for the closet where it should turn on when opened and turn off when closed and then turn off if left open for 10 mins. I do think I am missing something here where if I turn the light on and the door is already open I only want the light to stay on for 10 mins.

The second rule is for the front door light, that one seems to be working great now!

Thanks! I put that in place and it worked perfect tonight!

Here is a rule for a cupboard under the stairs.
If the door is not fully closed it will turn off after 20 minutes or straight away if the door is fully closed.

The only piece I'm missing is there a way to add in if the door is already open and I turn on the light, turn off in 10 mins

You had it in the first post. Action for true, delayed off pending cancellation.

I think I am missing something. If the door is open and the light is off and I turn it on and the door stays open the light stays on and does not turn off.

Because you didn't say that. You never said you wanted the light being as a condition of turning it off. You said, if the door is open, turn the light on and turn it off after 10 mins or if the door is closed. If you also want the light to turn off after 10 mins when turned on and the door open, then you need to break this down into 2 rules. The first would be a "Trigger". Door open, light on. The second would be a rule and the conditions would be Light on and Door open and the actions for true would be a 10 min delay with cancel on truth change and turning the light off. The action for false would be turning the light off as well with no cancel.

Thanks. This was the missing piece. I've got everything moved over from ST and most of my rules recreated.

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