Change your trigger to Motion âchangedâ instead of active.
Also, youâre going to want to add a âCancel delayed actionsâ to your IF actions.... AND modify your ELSEâs delayed OFF action to be a cancellable.
It works!!!! Thanks a lot. Newbie mistake. Btw, I assume that your other suggestions will allow the lights to stay on until thereâs been no motion for 2 minutes? Otherwise it turns off lights after 2 minutes regardless? Hereâs my new setup:
If you want it to stay on during motion change the following.
This should work...
Trigger
Motion changed
If time and motion active
Cancel delayed actions
Turn on
ELSE if motion not active and time is this and light is on
Turn off after delay of 2 mins With cancel on
End IF
FWIW, there's an example exactly like what you want in the Rule 4.0 documentation--I know it doesn't sound fun to read, but RM is complex and I'd recommend doing so.
I'd also recommend Hubitat Simple Lighting or Motion Lighting for this automation instead. They're a lot easier to set up (for anyone but especially if you're new to the platform), either can handle everything you're doing, and they might execute a bit faster since they are much smaller apps than Rule Machine and take less time to load (milliseconds, possibly only dozens or hundreds, but possibly important if you're walking into an indoor room).
Good luck either way, and glad you got it figured out in RM!
I tried that first but I couldnât find a way to add the âParents awakeâ virtual switch as a condition. Maybe I missed it. I want to avoid lights turning on while we sleep. The virtual switch is triggered by my GH âgood morning/good nightâ routines. It works really well right now.
Have you looked into using the Hub's built-in MODES feature? Since you are executing a Good Morning and Good Night set of automations, you could easily have these set the MODE accordingly. MODE is available in most built-in Apps to help adjust the behavior of automations to be specific to the current MODE of the hub. Just an idea in case you hadn't already considered it. I use modes of AWAY, DAY, EVENING, and NIGHT. I try to keep it simple.
Thatâs the first thing I looked at. Keep on mind Iâve had HE running for only a week. But the modes
Didnât seem to fit my use case. First off, I wanted these to be triggers as well (I.e. say good night to GH, which flips the awake timer, which executes actions in Hubitat). Secondly, the modes didnât seem to offer enough variety. So for instance, if I want an independent âaway/sleeping/etcâ mode for each member of the family, I donât believe you can achieve that with modes. I could be wrong.
Whoops so I read the docs again and I think maybe the second one is achievable. But it seems like I would need a virtual switch to integrate with GH anyway, so it would be another layer of complexity. Again, correct me if Iâm wrong.
I run my whole house on modes. They are probably Hubitat's strongest feature (imho). For your condition about setting up the home up for sleep, I use a virtual switch exposed to Alexa. When my wife and I go to bed, we tell Alexa "Good night" and it flips the switch which triggers the mode to change to Home - Overnight which kicks off another rule that shuts off all the lights, locks the doors, etc. Then, I have another routine in Alexa that flips another virtual switch in the morning while my wife gets ready for work. All of this can be accomplished just as easily with Google Home.
I completely missed this. You are correct, however, you can achieve this by combining modes with presence. I do that in a few of my rules as I want some things to fire only when I'm home and my wife isn't and the mode is in a certain state:
OK, I missed the virtual switch check in your Rule. You've gotten some great advice about modes and virtual switches above, but I'll just add that Motion Lighting does have "Switch to disable turning on" (and another for "off"), so you can restrict parts of the automation that way. Unfortunately, it only lets you choose one switch (but if you ever need more than one, perhaps you could handle that logic in Rule Machine and let Motion Lighting do what it does best). There are also a bunch of other options you can explore; the docs I linked to above explain most.
Of course, you can also keep using Rule Machine; I didn't mean to steer you away, just point you towards easier-to-use built-in apps that might meet your needs (and be a bit faster at them, usually not quite enough to be noticeable to a human, but some people here have been intrigued with measuring this lately).
Thanks everyone. I am actually quite blown away with the features of Hubitat not to mention the amazing help Iâm getting from the community. Iâve used Home Assistant and ST before and they both had major shortcomings, enough to drive me away. Hubitat seems to have BY FAR the best combination of usability, reliability, and responsiveness, coupled with great device support and great integration options. I will have to do more research (based on your advice) on the use of modes and motion lighting apps to get the best functionality. I love the fact that not only can I achieve what I want without major headache (unlike HA/yaml madness, and unlike ST/âwhy did it take 5 minutesâ bewilderment) but there are multiple ways to achieve it. My wife will hate me for the next few months.