Hello. I’ve been trying to use input_datetime to set a time that will be used as a trigger for an automation. Try as I might, I can’t seem to get the automation to recognize when this time is met and trigger correctly. I have the input configured as follows:
input_datetime:
weekday_time:
name: "Weekday Sunrise Time"
has_date: false
has_time: true
initial: '05:00'
I have added a sensor for time_date to compare against a template in the automation:
sensor:
- platform: time_date
display_options:
- 'time'
And have created a test automation to trigger when the time matches:
automation:
- alias: 'Test Time'
trigger:
- platform: template
value_template: '{{ states.sensor.time.state == states.input_datetime.weekday_time.state }}'
action:
service: notify.ios_iphone
data:
message: 'It worked'
I’ve triggered the automation through the web UI of Home Assistant and confirmed the notification isn’t the culprit. In trying to resolve the value_template in the template editor in Home Assistant, I can see that states.sensor.time.state gives the time in %H:%M format (e.g. 05:00) and states.input_datetime.weekday_time.state results in %H:%M:%S (e.g. 05:00:00) format.
To try to resolve this, I tried the following template instead but came across the same results.
{{ now().strftime("%H:%M:%S") == states.input_datetime.weekday_time.state }}
Clearly I’m missing something, but after hours of trial and error and searching throughout the forum, I’m coming up short in finding any guidance on using time from input_datetime as a trigger. Any insight you can share would be greatly appreciated!