Comparing the clock with a fixed time of day in a template invites string tricks on now(). today_at gives you a real datetime for “today, at this hour”, and datetimes compare without any ceremony.
It takes an optional string in HH:MM or HH:MM:SS format and defaults to 00:00. Here are the examples from the docs:
{{ today_at("08:00") }}
{{ now() > today_at("18:00") }}
{{ today_at("18:00") <= now() < today_at("23:00") }}
{{ ((today_at("17:00") - now()).total_seconds() / 60) | int }}
The first prints something like 2024-03-15 08:00:00+01:00, a datetime with the time zone included. The second is a plain true or false. The third is an evening window in one line, which works well as a template condition. The last one counts the minutes until five o’clock, because subtracting two datetimes gives a timedelta.
The caveat is the word today. The result is always today’s date, so a window like “22:00 to 06:00” does not work as one chained comparison. It would need two parts joined with or. For a plain time window in an automation, the ready-made time condition is the simpler choice. Home Assistant 2021.12 is the version the docs name for this function.
Further reading: today_at in the Home Assistant template functions