Template Sensor not working since upgrade to 2021.6.6

Upgraded from 2021.4.6 to 2021.6.6 and this template sensor doesn’t seem to work anymore.

If I paste it into Developer Tools - Template, it works as desired.

If HVAC fan is off, proper operating mode is shown in Lovelace. But when in cooling mode, it shows Fan Only.

Developer Tools - Template:
image

Lovelace:
image

Any ideas?

    hvac_mode:
      friendly_name: HVAC Operating Mode
      value_template: >-
        {% set hvac_temp_delta = states('sensor.supply_temp') | float - states('sensor.return_temp') | float %}
        {% if is_state("binary_sensor.furnace_fan", "on") and hvac_temp_delta > 10 -%}
          Heating
        {%- elif is_state("binary_sensor.furnace_fan", "on") and hvac_temp_delta < -10 -%}
          Cooling
        {%- elif is_state("binary_sensor.furnace_fan", "on") and 11 > hvac_temp_delta > -11 -%}
          Fan Only 
        {%- elif is_state("binary_sensor.furnace_fan", "off") -%}
          Off   
        {%- else %}
          Unknown
        {%- endif %}

Try this version:

    hvac_mode:
      friendly_name: HVAC Operating Mode
      value_template: >
        {% set delta = states('sensor.supply_temp') | float - states('sensor.return_temp') | float %}
        {% if is_state('binary_sensor.furnace_fan', 'on') %}
          {% if delta > 10 %} Heating
          {% elif delta < -10 %} Cooling
          {% else %} Fan Only 
          {% endif %}
        {% else %}
          Off   
        {% endif %}
1 Like

Thank you Taras! Not only does it work, but it looks nicer than my version!

1 Like