I feel this should be simple but I'm missing something

So I'm trying to create a fan rule but I feel stupid because I'm missing something obvious

Rule explanation: Someone enters powder room, light automatically turns on (this is handled by a simple motion rule) Rule created is supposed to do the following. When Powder room motion sensor is inactive, it should check to see if the powder room switch is on and the fan switch is on. (Note: I give it a minute to allow someone to turn on the fan. If the fan isn't on then nothing should happen) If both devices are on and the powderroom motion sensor goes inactive it should wait 10 minutes to turn off the fan if the fan is left on (note the simple motion rule that turns on the light switch turns it off after 5 mins inactive, this shouldn't matter to the fan off rule as the fan off rule has already been triggered) Can someone tell me what obvious thing I'm missing? The fan doesn't turn off is the problem

Hereā€™s my rule, I keep mine on for 30 minutes :joy:

Motion or turning off main light triggers it. Main light switch is a GE Motion Switch, which is why itā€™s included in the trigger.

1 Like

The biggest problem I see is that any time a rule is triggered, any Waits are cancelled. In this rule, you have a "Wait for event" that matches your trigger event. This behavior is undefined, and you're likely to have some cases where the rule realizes it was triggered, cancels the delay, and does nothing; and others where the rule sees that the "Wait for event" happened, then proceeds--but still starts again because it was triggered. (Because your delay is not cancelled when the rule re-triggers, this can result in the following actions happening more than once at unpredictable-to-normal-people times, so I'd probably also either mark it cancelable and use a "Cancel Delayed Actions" first thing, or--my new preference--use a "Wait for event: elapsed time.")

Beyond that, with that wait, you're not really waiting for the sensor to be inactive for 10 minutes; you're waiting for it to become inactive or for 10 minutes to pass, whichever comes first. In Rule 5.0 (which it looks like you're using), to get this effect in general, you can use a "Wait for condition: motion inactive --> duration 0:10:00" instead. Note that this waits for a condition (motion being inactive for that amount of time, not just becoming inactive--an event) and use a duration rather than a timeout (a timeout will proceed after the time if the event/condition doesn't happen/become true; you don't want that). With your trigger, you also wouldn't really need to wait for this event/condition at all, since your rule is only triggered by motion inactivity (nothing in your actions changes anything if it becomes active again in the meantime), but that is probably an issue you'll also want to address.

Also, you've probably thought this through, but do you need the minute delay? Since you're triggering on motion inactive, someone has probably either been in the room a while and had enough time to think about turning on the other switches, or they've recently left and might never come back to do so. Most sensors take a minute or more (some a few seconds if configurable--but most not by default) to report inactivity, so the "built in" delay of your sensors might be enough to handle this without writing it into your rule.

Anyway, here's a rule similar to yours that I think would do what you want:

Trigger events: Motion active

Actions to run:

Wait for condition: motion inactive --> duration 0:01:00
IF (Switch 1 on AND Switch 2 on) THEN
  Wait for event: elapsed time --> 0:10:00
  Off: Switch 1
END-IF

I've switched the trigger to "motion active" in order to take advantage of the fact that this will cancel waits, which sounds like match for what you want to happen here. If you decide you don't want the initial 1-minute wait/delay, you can just swap that first action out for a "Wait for event: motion inactive," and that should work.

1 Like

"Powder room" lol!!!!

@Inge_Jones That's what we yanks call a half bath (Toilet and sink only)

2 Likes

That's a great explanation. While I'm very good at hardware diagnostics, sometimes I still struggle with simple logic programming like this.. Makes me feel like a dope. Thank you! I'll give it a whirl and see what I come up with and report back

We rednecks in the South call them powder rooms too. :rofl:

2 Likes

What's wrong with thunder box!!!!!! :slight_smile:

2 Likes