Help With Door Contact and Motion Rule

I'm sure I am missing something in this rule or may have to split it in two.

I have a light in the laundry closet that goes on when the door is open via a contact. I would like it to turn off when the door is closed or if the door is left open then turn off when motion in my kitchen motion detector is inactive for 5 minutes.

Any help would be appreciated.

Your first IF/THEN/ELSE has no corresponding ENDIF. I'd suspect that's the root of the problem. It looks like you just need to add an ENDIF to the end of the rule.

A couple of things to think about, but I don't think they will affect how the rule works.

  • on your second IF statement it looks like the "if laundry closet open" is redundant because if it is closed it won't process these lines anyway based on the first IF. Probably not material but it's just cleaner.
  • your trigger statement should work just fine. You may want to consider using a trigger that says "laundry closet changed." Shouldn't make any difference at all, just sooths my OCD.
  • Take a look at the built-in motion and mode lighting app... nothing wrong with using RM but the app is easier for stuff like this. Unless you're just playing with RM to understand it better, which absolutely makes sense.
1 Like

Thanks a lot. Iā€™m going to give the motion app a shot.

1 Like

Nice. That looks simple enough.

@jasonp9 I think you're looking for a duration on the inactive motion and not a timeout so you need to use Wait for rule. I think putting a duration on a Wait for rule applies it to everything in that Wait. I suggest the following option for your rule:

Trigger:
Laundry Closet *changed

Actions:
IF (Laundry Closet opened) THEN
    On: Laundry Closet Light
    Wait for rule: mZone-Kitchen inactive --> duration: 0:05:00
END-IF
Off: Laundry Closet Light
2 Likes

Would this turn off the light when the door is closed?

It would, anytime a rule is triggered waits are cancelled. So if the door is opened it turns on light and waits for inactivity on the sensor for 5 minutes. If you close the door while the rule is waiting for inactivity, the rule is triggered again, the door changed states. So the IF is bypassed, because door is closed, and the light turns off.

2 Likes