Switch off regardless of how turned on except if motion sensed

New here so be gentle. :slight_smile:
There may be simpler apps to accomplish but trying to learn Rule Machine 4.0 after the ST days.
I have a bunch of Webcore rules where their sole purpose is to turn lights off if no motion regardless of how they were turned on. Ie physically or or by any Webcore, ST rule etc.
They restart shutdown timers if motion sensed.

Have created the below but it shuts of the switch regardless if motion sensed.
What do I need to do to correct?
Thanx, Abe

Rule

I would recommend the following:

Trigger:
Tri Sensor becomes *Changed *

Actions:
Cancel Delayed Actions
if Tri Sensor = inactive
Off: Virtual Switch ā€”> delayed: 0:00:30 (cancellable)
Endif

The first thing that happens is that it cancels your delayed shot down if motion changes (becomes active again before time-out).

Then, only when the motion stops will your timer begin.

Let me know if it works for you!

Also, welcome to the community!

Hi. Thanx for the reply.

The reason that I started out down the path of using if switch is on is I have a few switches in gang boxes and believe it or not the family sometimes hits the wrong switch and just leaves it. Hard to belive, I know. This way say if they accidently turn on say the garage lights if no one is in there the lights shut off as there is no motion there. Also if you have multiple rules turning on a switch with various scenarios I only need one rule to shut off. So unfortunately using a motion sensor as the trigger does not work in some cases.

The below is what one of the basic rules look like in Webcore and works great. I have others with time of day, day of week etc restrictions.

If
Switch is on
and
All of Motion sensor 1 and Motion sensor 2 are inactive

then
with
Switch
do
Wait 15 minutes
Turn off

Ah! I totally get it. Seen that a few times myself...

The problem with the rule as written in the screen shot is that once the 30 second timer is started, there is nothing in place to stop it. So when you go to the room and activate the motion detector, it still counting down and will shut down no matter what... (And slightly annoy your family member... :wink: )

What I would do then is just add your ā€œVirtual Switch(off) turns onā€ trigger to the example I provided. In that case, if someone turns it on but there is no one in there, it will see that motion is inactive and turn it off after 30 seconds. If someone steps in the room before the 30 seconds, it will cancel the delayed action and keep the light on until there is no longer any motion.

Hi.
Well tried a few different things and still no luck.
Cant post pictures so it makes trying for you to help a little difficult. Will do some more searching to see if I can find something.
RM 4.0 does not seem as intuitive to me as the version that was in ST. Dont recall having this many issues on a simple rule back then.
Thanx, Abe

You may need to go through the introductory tutorial to be able to do this.

It does take some getting use to. Once you get the hang of it, it becomes relatively easy to use. It took me several months to get to that point though...

Does your rule look like this?


(Kitchen and Entryway Keypad are both motion sensors)

Just in case you were not yet aware, you can still use webCoRE with Hubitat (locally!). If your goal is to try out Rule Machine, then I totally get that, too.

Well made one that looks pretty much identical to yours and no luck.

image

Had to be trusted up a level before i could post pictures

Try adding them Tri Sensor changing as one of the triggers and let me know if that makes a difference...

so you want it to stay on forever ? once turned on if there is no motion..

if thats the case then

trigger switch turned on

if no motion
off
end if

the one you have above should do the same. how is it not working.. maybe you have zwave issues

If the switch is turned on for any reason it should only stay on if there is motion. If the motion stops then start the timer to shut off. If motion resumes reset the timer and keep light on.
Hopefully my rambling makes sense. :blush:
Thanx, Abe

Thought I would try diving off the high diving board to get in deep with RM. :blush:

that wont work becuase you also as mentioned need motion as a trigger. otherwise once the rule exits after the switch is turned on if there is motion it will never turn off.

trigger
switch turns on
or motion changed

rule
cancel delayed actions
if switch on

if no motion
off delay 10
end if

end if

Iā€™m curious @kahn-hubitat... Why check if the switch is on (in the actions)?

performance saves an extra check and scheduling and wakeup that is not necessary

if you were going to do it with no delay .i would remove it and just put the motion check and turn off

1 Like

Hi
The way I have many of my rules set up in ST is that they only turn on a light but not off. I have multiple rules and or conditions in smart lighting and webcore to accomplish this. The switch might also be turned on physically at times.
Then I have a number of webcore rules to only turn the off the light if there is motion around as well as other restrictions. Works great. Below is a simple version.
image
I cant use motion sensors as triggers to accomplish this as they may not change depending on the situation.
Thanx, Abe

my solution above takes care of that .. try it.. that is why the switch and the motion are both triggers.

Well that works great. Thank you very much.
Just curious what the END-IF dangling at the end accomplishes.

image

1 Like

Itā€™s just to close off your if statement. A good practice.