Need help with a rule for a ceiling fan

Hello! I have tried a few times to set this rule up, but I can't quite seem to get it.

Basically - my daughter has a ceiling fan in her room, and I have a multisensor in the room. From 8am-10pm If there is no motion in the room for 30 minutes I want to turn the ceiling fan off.

Help! :slight_smile:

Thanks in advance,


look at event engine very easy to do in that app

Here's one way:

Option 1

Trigger: Mutlisensor motion *changed*


IF (Motion active) THEN
  Cancel Delayed Actions
  IF (Time is between 8 AM and 10 PM) THEN
    Delay 0:30:00 (cancelable)
    Off: Fan

Alternatively, here is another way you could create the same automation:

Option 2

Trigger: Motion inactive


IF (Time between 8 AM and 10 PM) THEN
  Wait for event: Motion active --> timeout 0:30:00
  IF (Motion inactive) THEN
    Off: Fan

Either should have the same outcome. The first is a classic paradigm you'll see throughout the docs, which I'd recommend reading if you haven't. The latter is a paradigm staff and many community members have been suggesting recently that may be simpler. (You could make it even simpler to write by using a simple condition instead of a "full"/IF THEN conditional for the "IF (Motion inactive)" thing, but I prefer using full conditionals from the get-go because it makes adding additional actions within that block easier; a simple conditional limits you to a single action, but would certainly do if the "off" is your only action.) This one only triggers by default with a motion "inactive" event, then either ways for motion to become active (in which case the rest of the rule actions will be evaluated, but nothing will happen since they'll all be skipped; the rule will then still be around to wait for another inactive event) or 30 minutes to pass (in which case the sensor should still be inactive, so the actions inside that inner IF THEN will run).

1 Like

Thanks! This works... :slight_smile: Part of the problem (I am a new hubitat user) is just getting used to the UI to build the rules - if I could just type them in it would be easier... :slight_smile:


Not an uncommon request! (But unfortunately not possible--but if you know how to program you can write your own apps in Groovy.)

If you want to see the UI (which can indeed be awkward) in action, I'd recommend taking a look at the RM videos from Hubitat's YouTube channel, like this one: It may also be good to know that you can find a list of actions--and what "category" they fall under in the dropdowns--in the docs. Good luck!

The examples posted above will work, but if the fan is on before 8AM and there has been no motion in the 30 minutes (or more) before 8AM, the two rules posted above will not turn the fan off at 8AM or anytime after 8AM unless your motion trigger is activated. If you want the fan to turn off at 8AM if there has been no motion in the 30 minutes before 8AM, you could do this:
Rule 1
Trigger: Multisensor Motion becomes active
Cancel Delayed Actions
Set Global Variable Named "Daughter's Bedroom Motion Last 30 min" to YES
Set Global Variable Named "Daughter's Bedroom Motion Last 30 min" to NO
Delay 30 min (cancelable)

Rule 2
Triggers: Global Variable Named "Daughter's Bedroom Motion Last 30 min" changed or Time is 8:00 AM.
If time is between 8:00 AM and 10 PM and Global Variable Named "Daughter's Bedroom Motion Last 30 min" = NO Then
Off: Fan

The two rules combined will do what you want. As it has been said before, rules are free make as many as you want.