Turning off one switch after another switch is off and STAYS off for a certain time

In Smartthings using WebCoRE, it's very easy to do the following:

IF bathroom light switch stays off for 5 minutes, THEN turn off bathroom fan

The key here is for the switch to STAY off. If Person A leaves the bathroom and turns off the light, 5 minutes later the exhaust fan will shut off. However, if Person B comes in to the bathroom to take a shower before the 5 minutes is up, they will turn on the light which will cancel the automation. Don't want the exhaust fan shutting off while they're in the shower, after all.

I can't figure out how to do something like this in RM. I know that you can delay an action, so I can easily have the fan turn off five minutes after the light is turned off, but how would I cancel this if the light is turned back on?

Try this

Trigger
Bathroom Light *changed

Action
Cancel Delayed Actions
IF (Bathroom Light Off) Off Bathroom Fan --> delayed 0:05:00 (cancelable)

Not that this IF is a simple condition, no THEN and no END-IF needed.

2 Likes

Like this?

I tested this and the auto-off part works, but it does not get cancelled when the light is turned back on. And I'm not sure why it would. I don't see what would cancel it. What does checking the Cancelable? box actually do?

EDIT: Wait. I think I forgot something. Testing again.

EDIT 2: Yep. That fixed it. :joy:

Thanks for the help. This stuff isn't always easy to figure out.

1 Like

Glad to help. In addition to the Cancel Timed Actions you can use Cancel Delayed Actions which is found under "Delay or Repeat Actions, Wait"

https://docs.hubitat.com/index.php?title=Rule-4.0#List_of_Actions

2 Likes

In that case, what is the difference between timed and delayed in this context?

In this context I don't believe there is a difference since you don't have the other actions that Cancel Timed Actions will cancel. For a case like this I prefer to use Cancel Delayed Actions and was just pointing out where to find it.

1 Like

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