Input_datetime condition template evaluates to false, but dev tools shows True

I have a datetime input that stores the last execution date of a certain automation:

has_date: true
has_time: false
editable: true
year: 2022
month: 10
day: 29
timestamp: 1667019991

The following in a dev tools template evaluates to True:

{{ today_at('00:00') }}
{{ states('input_datetime.last_run') | as_datetime | as_local }}
{{ today_at('00:00') > states('input_datetime.last_run') | as_datetime | as_local }}
2022-10-30 00:00:00+02:00
2022-10-29 00:00:00+02:00
True

But the same condition in a template in an automation condition evaluates to False according to traces:

condition: template
value_template: |-
  condition: template
  value_template: >
    {{ today_at('00:00') > states('input_datetime.last_run') | as_datetime | as_local }}

Any hint on what the issue might be?

Can you show the full trace (three dots icon).

You seem to have a copy/paste error… get rid of the extra configuration keys:
FWIW, you can just leave the args blank when using today_at() for “00:00:00”.

condition: template
value_template: >
  {{ today_at() > states('input_datetime.last_run') | as_datetime | as_local }}
1 Like

:man_facepalming:
Thank you!

1 Like