What are the results of this automation (heating control)?

Hello,

I found here an interesting looking snipplet to control the heating and I wonder, which exactly rules are the output of the percent calculations in this automation. Can someone explain the rule in simple words? What, if it‘s 5 degrees C outside in combination with the other stuff?


service: climate.set_temperature
data_template:
  temperature: >
    {% if states('sensor.netatmo_mw_outside_temperature') | int > 25
    %}
      19
    {% elif states('sensor.netatmo_mw_outside_temperature') | int >
    15 %}
      20
    {% elif states('sensor.netatmo_mw_outside_temperature') | int >
    0 and states('weather.home') | lower in ['sunny', 'partly cloudy', 'mostly
    cloudy'] %}
      22
     {% elif states('sensor.netatmo_mw_outside_temperature') | int > 0 %}
       23
     {% else %}
      24
     {% endif %}
entity_id: 'climate.thermostat_5,climate.thermostat_6'

It is important to realise that the expressions are tested in order and the first one that evaluates to true determines the result e.g. if the outside temperature was 16 then the second expression is true setting the temperature setpoint to “20”.

If the tempefrature outside was 5C and the weather part of the expression is also true then the third expression sets the setpoint to “22”.

If no expressions evaluate to true then this results in a setpoint of “24” (i.e. the ‘else’ part of the template).

You need to think through all the expressions carefully to ensure that they are testing in the correct order (e.g. high to low) and there are no abnormal results e.g. what would happen if weather.home as ‘unknown’.

Thanks for the explanations. I’m going to test it out.