Light on manually, off if no motion after delay

New to Hubitat and am confused with the best way to achieve the following:

If any switch in the bathroom is turned on, leave it on for X minutes after there's no further motion detected, then turn it and all other switches in the bathroom off. If motion is detected again later, restart the delay timer.

Tried the Motion App with no on switches defined (as I don't want it come on automatically, just off automatically), but that didn't seem to work. Then tried Rules Engine 4.0 but am confused with Cancel Delay Events and how to structure.

After a few hours of trying, I'd sure appreciate someone pointing me in the right direction or offering a template to start working with.

Many thanks in advance.

Welcome to the community! Check out the built-in Simple Lighting app. I use this for just the same scenario (lights on without motion, lights off with motion inactive).

Thank you greatly for pointing me in the right direction! It works. I created 3 Simple Lighting routines to work in concert to achieve what I am after.

For purposes of learning and expanding the capabilities, could you or someone tell me how to write my Simple Lighting routines as a RM 4.0 rule?

If Day Mode THEN
If any of the 7 switches Master Bath is manually turned on THEN
Leave lights on as long as there is motion PLUS 20 more minutes
End If
Else if Evening or Night Mode THEN
If all lights in the Master are off AND Motion is detected THEN
Turn on just the night lights for as long as there is motion PLUS 10 more minutes
ELSE if any turned on AND motion is detected THEN
Leave the lights on as long as there is motion PLUS another 45 minutes.
End If
End If

'Just trying to take something that is working and making it work with a rule in hopes of getting more understanding of Hubitat capabilities.

Thanks so much.

LOL. You're welcome. I actually resorted to using Simple Lighting because I just can't grasp much of 4.0. That example I posted was the result of a couple hours of frustration and the realization my mind doesn't function in a logical way. I hope smarter minds will jump in a give you a hand.

Trigger events: motion changes

IF Mode is day THEN
    IF motion is active THEN
        Cancel delays
    ELSE
        Turn off All lights delay cancel 20mins
    END IF 

ELSE IF mode is Evening or night THEN
    IF Motion is active THEN
       Turn on lights X,Y
       Cancel delays
    ELSE
       OFF lights delay cancel 10 mins
   END IF
ELSE
   IF motion is active THEN
    Cancel delays
   ELSE
   Turn off All lights delay cancel 45mins
   END IF
END IF
1 Like