Limiting automation to times of day

Hey there, your use case sounds awfully similar to something a popular blueprint can do.
Will highly recommend taking a look at this awesome blueprint.

Motion activated lights, with an optional time condition and many other bells and whistles.