Time range condition template

That’s only if you don’t have todays date in the datetime. The original code you’re cherry picking is assuming its full date and time. You should have cherry picked the other template in the original response which has an additional line. It appears that the striptime isn’t making that assumption so you have to add it yourself, like the link suggests.

{% set t = now().timestamp() %}
{% set date = now().strftime("%Y-%m-%d ") %}
{% set fmat = "%Y-%m-%d %H:%M:%S" %}
{% set start = strptime(date ~ states('input_datetime.heating_weekday_morning_start'), fmat).timestamp() %}
{% set end= strptime(date ~ states('input_datetime.heating_weekday_day_start'), fmat).timestamp() %}
{{ start <= t <= end }}

No, I wrote it 50 versions and 2 years ago. Things have changed drastically and I don’t use input_datetimes because they’re terrible in the UI on mobile.

1 Like

I fully agree with you.