Hi everybody,
I have been using hard coded times for my climate automations in the past:
- id: "heizung_az_morgens"
alias: "[Heizung] AZ 07:45"
trigger:
- platform: time
at: "07:45:00"
condition:
condition: state
entity_id: input_boolean_az.fenster
state: "off"
action:
- service: climate.set_temperature
data_template:
entity_id: climate.arbeitszimmer_heizung_climate
temperature: "{{ states('input_number.az_morgens') | float }}"
How much can I integrate variables to make this easier? I tried the following, but it is not working:
automation:
- alias: "[Hei] AZ Morgens"
trigger:
- platform: time
at: input_datetime.az_morgens
variables:
temperatur: input_number.az_morgens
heizung: climate.arbeitszimmer_heizung_climate
condition:
condition: state
entity_id: input_boolean.az_fenster
state: "off"
action:
- service: climate.set_temperature
data_template:
entity_id: climate.arbeitszimmer_heizung_climate
temperature: "{{ states('temperatur') }}"
- service: script.debugger
script.debugger
will send a notification. When I remove the service: climate.set_temperature
part, it will work. With that part there nothing happens.
What would be even better:
automation:
- alias: "[Hei] AZ Morgens"
variables:
zeit: input_datetime.az_morgens
temperatur: input_number.az_morgens
heizung: climate.arbeitszimmer_heizung_climate
fenster: input_boolean.az_fenster
trigger:
- platform: time
at: "{{ zeit }}"
condition:
condition: state
entity_id: "{{ fenster }}"
state: "off"
action:
- service: climate.set_temperature
data_template: # also tried `data` instead of `data_template`
entity_id: "{{ heizung }}"
temperature: "{{ temperatur }}"
- service: script.debugger
If this last piece of code could work somehow, it would be so much easier to automate all this. I have one automation per climate entity each for the morning and evening; some rooms then also have an additional value for the morning and one for night time (all looking similar to the first piece of code I posted).
What do I need to change in order to make this work? Thank you for your help