Hi everyone,
I am trying to optimize some of my scripts and automations using simple templating. And in some cases not even templating, but basic conditions.
However, I keep running into issues.
So, problem 1. I would like to change the temperature of different thermostats depending on whether or not the bedroom is already being heated.
This approach fails because the “above” is not supported. But at the same time it does not seem allowed to state: >5
.
How can I solve this?
automation:
- alias: "Climate: Off"
id: climate_off
mode: single
trigger:
- platform: time
at: "22:00:00"
action:
- if:
- condition: state
entity_id: climate.eq3_climate_master_bedroom
attribute: temperature
above: 5
then:
- service: script.climate_sleep
else:
- service: script.climate_off
I then also tried going the integrated approach, i.e. not creating additional scripts when the script service call should work also in automations directly. That way I can remove a source of error (target script name changing).
But, again, it seems that Automations
do not allow templating even though Scripts
allow precisely this service call.
automation:
- alias: "Climate: Off"
id: climate_off
mode: single
trigger:
- platform: time
at: "22:00:00"
action:
- service: climate.set_hvac_mode
data:
hvac_mode: heat
target:
entity_id: '{{states.climate|selectattr(''entity_id'', ''search'', ''climate.eq3'')|map(attribute=''entity_id'')|list}}'
- service: climate.set_temperature
data:
temperature: 4.5
target:
entity_id: '{{states.climate|selectattr(''entity_id'', ''search'', ''climate.eq3'')|map(attribute=''entity_id'')|list}}'
(Info: I did not add the condition of the bedroom temperature yet because it failed already without that )
So templating the entity_id works in scripts but not in Automations. Why?
Would someone in the community please help me out and let me know why none of the above work (even though they look so straight forward) and how I could solve these issues?
Thank you
Alex