Routine creation help needed: time filter from sunset to 11pm?

How do I make a thing turn on when the mode changes but only between sunset and 11 PM?

I would need 3 routines and a virtual switch (called Dark). You are basically using the virtual switch as a variable.

1st routine - turn on Dark at Sunset
2nd routine - turn off Dark at 11PM
3rd routine - if Dark is on as a precondition & the mode changes then turn on your thing

There might be a simpler way but I can’t think of it.


I tried doing it in smart lighting like this. It didn’t work. Basically I’m trying to turn the light on in my house when I get home (the mode changes when I get home) but only if I get home between Sunset in 11 PM.

have you tried a routine with the time window as a precondition, the mode change as the trigger, and the thing turning on as a the result?

I have tried that but there is no option to set a time period between sunset and 11 PM. It’s either sunset and sunrise or other predetermined times. Not a mix of both.

I have a similar job in Smart lighting that turns on lights when I arrive at my cottage between 15 minutes after sunset and 30 minutes before sunrise. But instead of the Location mode section I am using the Device status section and the cell phone as a presence sensor. Actually it’s a virtual presence switch that gets changed based on the presence of the cell phone, but I see that the cell phone is in the list of selectable items as well.

Update: I just tried your method and it did work. I mimicked your Location mode by selecting Home and Night. If I changed modes to either of those two, my light turned on.

Thanks for this, it worked for me. I don’t know why sunset to a time can’t be added in SmartThings. It’s the one thing I miss about Wink.

1 Like