I’m having some trouble creating an automation. I’m trying to set a bedtime input_datetime that I will use to trigger other automations. The value should be different on a school night or a weekend. This is what I have:
service: input_datetime.set_datetime
target:
entity_id: input_datetime.bedtime_today
data: |-
{% if is_state('binary_sensor.workdaytomorrow', 'on') %}
time: '{{ states("input_datetime.bedtime_weekday") }}'
{% else %}
time: '{{ states("input_datetime.bedtime_weekends") }}'
{% endif %}
This code works in the developer tools template and gives the expected values. But in an automation it gives an “Error: Error rendering data template: Result is not a Dictionary”. I’m fairly new to HA and any help would be appreciated.