Lights off after X mins after sunset or illuminance

Need a bit of help with a simple rule that turns on the outside lights if the time is sunset or its dark out, then sets the mode to evening if its sunset, waits X mins and turns the lights off. I'm trying to use a turn off time as X mins after sunset to add some randomization to when the light turns off.

Rule works to turn on lights but lights are not turning off properly, I'm guessing my IF statement is screwing something up. I do see a scheduled job in the rule but its not turning the lights off.

If there's a better or easier way to do this I'd appreciate the guidance. I don't see a way to do what I want in the mode/motion lighting app.

Might be easier to remove the wait and the greater than 100 lux and just set the lights to off with an 5hr delay.
I’d move any lux greater then 100 automations to a sunrise rule.

once it crosses midnight, the time resets. so unless the sun sets before 6pm local time, the sunset+300 minutes will always happen the next day. in that case, sunset won't happen for another 18+ hours, so your wait for event will never happen

you could try off (all the lights) on a 300 minute delay instead

Didn't know that, thanks. Something like this should work then right?

1 Like