Transition 23:59 to 00:00 problem

Good day everyone,

I would like to make a template sensor that is on from 20:00 to 04:00 and off the rest. I can’t seem to get it to work. I’m constantly having the problem from 23:59 to 00:00. How do I solve this? It probably won’t be that difficult, but I really can’t figure it out.

Thanks for every response

Don’t use a template sensor, use this:

Can be set up in the UI or YAML. Supports sunrise/sunset with offsets too.