When setting up a few routines to replace my Smart Lights, I have a couple that I would like to start at sunset or a specific offset + or - sunset up to when I typically go to bed and consequently a different routine to run from bed time to sunrise the next morning.
For example: I run my porch light at 10% brightness from Sunset to 10PM on weeknights and if motion is detected brighten it up to 100%. Then, on a different routine when motion is not detected for 5 minutes, it changes the brightness from 100% back to 10%.
After 10PM on weeknights up until sunrise, should motion happen, turn on the porch light to 100% and then another routine to shut that off after 5 minutes of no motion from 10PM to sunrise.
I checked all over when I tried to build the routine and my choices were at a specific time, during a specific time or between something like sunset and sunrise and the offset there…I could not combine the two.
I use a virtual switch to serve as a variable to track a time interval that includes a specific time and a relative time. So, I have a virtual switch I call “Nighttime” that turns on at 10:00 pm and turns off at sunrise. I use that as a precondition in a routine to alter the behavior of the motion and button triggers for some motion/dimmers.