Three thermostats, one HVAC system

Hi, my HVAC setup has three zones connected to a single furnace/air conditioner. Each zone has a thermostat and a damper controls if air is routed to each zone.

The thermostats (Honeywell T6 Pro Wifi) are connected to HA via HomeKit integration, they work fine and are represented as three climate entities.

I can extract each hvac_action from the thermostats with the following sensors:

  - name: PT HVAC Activity
    state: "{{ state_attr('climate.tstat_pt_thermostat', 'hvac_action') }}"
  - name: PP HVAC Activity
    state: "{{ state_attr('climate.tstat_pp_thermostat', 'hvac_action') }}"
  - name: Flex Room HVAC Activity
    state: "{{ state_attr('climate.tstat_flex_thermostat', 'hvac_action') }}"

My goal is to track the running time of the furnace/air conditioner by combining the states of all three thermostats.

If I understand correctly, I need to create a new sensor, let’s call it HVAC, whose values has the following rules:

  • If any of the thermostats reports ‘Heating’ => HVAC is ‘Heating’;
  • If any of the thermostats is ‘Cooling’ => HVAC is ‘Cooling’;
  • When all three thermostats are ‘Idle’ => HVAC is ‘Idle’.

Let’s assume that heating and cooling cannot be activated simultaneously on different thermostats.

How do I create such a rule?
Thanks in advance!

Create another Template Sensor that applies the rules you defined.

  - name: PT HVAC Activity
    state: "{{ state_attr('climate.tstat_pt_thermostat', 'hvac_action') }}"
  - name: PP HVAC Activity
    state: "{{ state_attr('climate.tstat_pp_thermostat', 'hvac_action') }}"
  - name: Flex Room HVAC Activity
    state: "{{ state_attr('climate.tstat_flex_thermostat', 'hvac_action') }}"
  - name: HVAC Activity
    state: >
      {% set hvac = [ states('sensor.pt_hvac_activity'), states('sensor.pp_hvac_activity'), states('sensor.flex_room_hvac_activity') ] %}
      {% if hvac | select('eq', 'heating') | list | count > 0 %}
        heating
      {% elif hvac | select('eq', 'cooling') | list | count > 0 %}
        cooling
      {% elif hvac | select('eq', 'idle') | list | count == 3 %}
        idle
      {% else %}
        off
      {% endif %}

I added a final else as a catchall in case the state of the thermostats, for some unforeseen reason, doesn’t match any of the three tests.

Thanks! Looks more elegant than my attempt, but functionally equivalent.
However mine still doesn’t work, the sensor shows up as unavailable. What is my error?

  - name: HVAC Activity
    state: >
      {% set pt_hvac_activity = states('sensor.pt_hvac_activity') | string('n/a') %}
      {% set pp_hvac_activity = states('sensor.pp_hvac_activity') | string('n/a') %}
      {% set flex_room_hvac_activity = states('sensor.flex_room_hvac_activity') | string('n/a') %}
      {% if pt_hvac_activity == 'idle' and pp_hvac_activity == 'idle' and flex_room_hvac_activity == 'idle' %} 
        idle
      {% elif pt_hvac_activity == 'heating' or pp_hvac_activity == 'heating' or flex_room_hvac_activity == 'heating' %} 
        heating
      {% elif pt_hvac_activity == 'cooling' or pp_hvac_activity == 'cooling' or flex_room_hvac_activity == 'vooling' %} 
        cooling
      {% else %} 
        n/a
      {% endif %}

Copy-paste the following template into the Template Editor and let me know what it reports.

{% set hvac = [ states('sensor.pt_hvac_activity'), states('sensor.pp_hvac_activity'), states('sensor.flex_room_hvac_activity') ] %}
{{ hvac }}
{% if hvac | select('eq', 'heating') | list | count > 0 %}
heating
{% elif hvac | select('eq', 'cooling') | list | count > 0 %}
cooling
{% elif hvac | select('eq', 'idle') | list | count == 3 %}
idle
{% else %}
off
{% endif %}

Ok, I just discovered the “Template” editor in the developers tools. This is much easier than testing in the config files! This is the output:

immagine

Your initial suggestion is working fine and I’m using it now, so that’s settled and thanks a lot for the help! But I feel like my initial attempt should have worked too. I am feeling suspicious about the “| string(‘n/a’)” filter in the initial lines… but it seems correct? What am I missing?

Also, I am having another issue - I activated the utility_meter integration and added it to my dashboard. However, the cooling elements don’t show up:

I guess that’s because there is no data about cooling and there won’t be for a few months, but is there a way to get a flat out zero in there instead of an error message?

Thanks for your help!

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.


I suggest you copy-paste your version into the Template Editor and observe the result of each variable you created. Experimentation in the Template Editor is a good way to learn.

Not sure about that one. It appears that the card you’re using demands a numeric value and the referenced entity’s value isn’t numeric. You can embed the card into a Conditional card and configure it to hide everything if the referenced entity is unknown or unavailable.