sensor:
- platform: template
sensors:
temperature_ghall_hvac:
friendly_name: "Garage_hall_HVAC"
unit_of_measurement: '°C'
value_template: >-
{% set t = states('sensor.pana_halli_outside_temperature') | float(0) %}
{% if 0.1 > t > -2.1 %} 18.5
{% elif -2.2 > t > -4.1 %} 19
{% elif -4.2 > t > -6.1 %} 20
{% elif -6.2 > t > -8.1 %} 21
{% elif -8.2 > t > -10.1 %} 22
{% elif -10.2 > t > -12.1 %} 23
{% elif -12.2 > t > -14.1 %} 24
{% elif -14.2 > t > -16.1 %} 25
{% elif -16.2 > t > -18.1 %} 26
{% elif -18.2 > t > -20.1 %} 28
{% elif -20.2 > t %} 29
{% else %} 17
{% endif %}
…and the corresponding script would look like this:
set_garage_hall_temp:
alias: Set Garage hall temp
sequence:
- service: climate.set_temperature
target:
device_id: c6d59cfa6cf443c19a372b6f317e22e7
data:
temperature: {{ states('sensor.temperature_ghall_hvac') }}
mode: single
icon: mdi:air-filter
Firstly, creating this kind of script seems not to work if i try to use HA graphical UI for script editing, although in yaml -mode. I needed to add it in text editor directly to scripts.yaml, otherwise it wouldn’t accept it. Script editor also tends to autocorrect things (wrongly). (Is there any documentation of this script editor UI?)
However, when reloading scripts after change, I get this in my log:
invalid key: “OrderedDict([(“states(‘sensor.temperature_ghall_hvac’)”, None)])” in “/config/scripts.yaml”, line 8, column 0
Everything is working now. Including control for the second HVAC I have there.
However, when creating more scripts, HA seems to autocorrect the syntaxes, if they are even touched with graphical script editor. According to the links You provided, they probably wouldn’t work as such. I did not test this, though. Anyway, from now on, if any new scripts needed, I’d probably better off creating them manually.