Yet another motion lighting question

I have several rules for time-slot & motion based lighting, all build the same way.
Works like a charm, expept for my kitchen lights.

I want the lights to fade in on motion, and turn off if no motion in X time.
What I see is that the lights turn on after 24:00 on motion, but turns of after X amount of time even if there is motion.

Example: Middle of the night, I go downstairs, walk into the kitchen, lights fade in. Smoke a sigaret while in the kitchen standing still. Move again after one minute, but after two minutes the lights turn off, and stay off even if there is motion again. Then after about a minute, the motion is picked up again, and the lights fade in again.

What I want is: motion > lights on > keep lights on for X amount if time > if again motion, reset the X timer > if no motion during X timer > fade off lights to 0.

Am I doing somthing wrong in my rule? :

Based on how you describe it sounds like your time to turn off lights is to short for the cool down period of your motion sensor. What if you extend your period of time out before it turns off with no motion. Does that make a difference.

Will try' thx

What happens if you change your rule to the following.
ELSE-IF
Time between xx and y THEN
Set Color
wait for event
Dim xxx delayed 0:02:00 (cancelable)

In other words remove your delay statement and move the delay (canceable) to the actual dimming of the light to 0.
Seems more logical to me.

1 Like

As I went back and looked at this again i also think what @bobbles is saying here is a good idea. You have two delay statements which makes the math for cooldown a little wonky.

Verify your cool down period for your motion sensor. You may want to just scan through the device events page and see what is the quickest amount of time during the day you see it go back to a active state. I also don't even have a wait for event state of inactive in my rules. just make sure you set your delay some portion above your motion sensor cool down. Like if it is 5 min set it to 7-10 min minimum.

Ok, tested.
When I remove the second wait, I see the following:
Motion > 30 seconds cooldown of sensor > no motion > dim down.
So you have to keep moving every 30 seconds, or the light wil dim down.

That is not wat I want.

I think you might get what you want if you do (Bolded the changes):

Wait for condition: Kitchen Motion inactive —> duration: 0:XX:00

And remove:
Cancel Delayed Actions
Delay 0:XX:00 (cancelable)

What this will do is only trigger when there has been no motion for X minutes, and I suspect this is what you are looking for…?

1 Like

Wil give this a try, thank you!

1 Like

FYI - There is a risk that it won’t work until 2.2.9 as there is currently a bug in that functionality:

1 Like

Wait for Condition with Duration does work. What the bug is that a subsequent Wait after that will fail to run the right actions.

2 Likes

Ah! Thanks for the correction! I had misunderstood.

1 Like

Wait for condition: Kitchen Motion inactive —> duration: 0:XX:00
And remove:
Cancel Delayed Actions
Delay 0:XX:00 (cancelable)

Works like a charm, Thank you Sebastien and all others for the tips given!

1 Like

Download the Hubitat app