Simplest light off option based on no motion


C7 - latest

I know I could write a webcore app to do what I wanted but really want to understand if rule machine or lighting app would have a simple option.
I have a rec room light, I have a virtual switch that will turn on momentarily each time a wyze cam has a motion trigger. How do I turn off the lights if the lights are turned on and there is no motion for 60 mins

In the RM, it implies it needs to see change (motion turns off) before counting to 60 ... if I turn on the light but don't trigger the motion sensor i dont think it will turn off.. was no motion in the last 60 mins (even if it didnt detect motion in the last 2 hours)

image
.
In room lighting, I don't see anything close to what I need

Basic Rules:

Room Lights:

Neither of these take into account that the light should be on. But, turning it off if it's already off is harmless.

5 Likes

so call me paranoid...but i feel like I have the potential for lights to be left on with the above solutions... since I can turn on the light at the wall, and possibly not trip the motion sensor

in webcore, I would store the last_motion_timestamp and the light_on_timestamp
and then every 20 mins
I would check if (now-last_motion_timestamp > 60) AND (now-light_on_timestamp > 60) and then turn off the light.

so in these simpler apps....is there a test for
Lights on > x
MotionSensors off > y ?
And can i combine them into a test?

I appreciate the earlier response...but trying to learn the capabilities.

thx
Tim

In Bruce's defense, this was not in the original post. The good news is that it still can be done in both Room Lighting and Rule Machine.


In Room Lighting, you need both the motion sensor and the switch itself to be Means to Activate. This way, if the switch is manually turned on, Room Lighting will still take over. Additionally, you want Activate even if partially activated in the options (you'll need it for later). In the Means to Turn Off, I have put three options: (1) Motion sensor inactive and stay, (2) manually turning off the switch, and (3) Elapsed Time. The latter is what you want. Basically, 60 minutes from the last Activation Event will turn off the switch. With the Activate option selected, every time the motion sensor goes active, it will reset the countdown.

As for Rule Machine:


Again, you need to put both the motion sensor and the switch itself as the triggers. In this example, you'll hit the switch with a second on command if it was manually turned on, but that won't hurt the rule. You could also adjust this action to be "command switches only if off" if that is desired. However, it's the wait for events that is key. I put the same three options as from Room Lighting, but it is the timeout that is the counter you want. Basically, it says that if neither of the other two go true (motion inactive or manually turning off the switch), the timeout will progress the rule after 60 minutes. With this design, every time the motion sensor goes active, it will reset the wait and thus the counter.

2 Likes

OMG, that is really cool....thanks you for explaining...looks very simple and foolproof.

p.s. I should have been clearer in my original post!

Ok , trying to implement the Actions part

and can't make sense of how to do...

Which part is giving your problems? With Rule Machine, you do each action individually. So, it would go:

First Action - Control Switches; Turn switches on/off
Second Action - Wait; Wait for Events
Third Action - Control Switches; Turn switches on/off

I watched the tutorial...and now it makes sense....
I made a simple RM and it works just like I want ..
Thanks again!

1 Like