Help on template - A template that identifies HVAC running in different modes; ie. heat and cool

Firends,

I have a four floor house with HVAC system installed on each floor. Each floor is connected to one outdoor unit and 3-4 indoor units (so all floors are isolated from each other). It is an issue if two unit on the same floors are running on heat and cool modes at the same time. So I want to make a template that identifies heat mode conflicting with any other mode (other than off). I want to use this to create an automation that will turn off all the HVAC indoor units if a conflict is detected.

Can somebody guide me what will be the best way to achieve it?

Thanks is advance.

Do you mean a value template or a template entity (i.e., Generic Thermostat)? The way you do it will differ a bit between the two, but the concept is mostly the same.

If it were me, for two units on the same floor, I would likely create a Generic Thermostat that uses a template switch. The template switch would then analyze the hvac_action attribute of each of the actual thermostats to decide what to do next, i.e.,:

{% if state_attr('climate.thermostat1', 'hvac_action') != state_attr('climate.thermostat2', 'hvac_action') %}
  .. do something here
{% endif %}

The difference is that you might use actual IF…THEN…ELSE statements if it’s a script, thus allowing you to easily call other services (how I would do it), if it’s a value template then the above would work better. The logic is essentially the same for both, just how you implement it would be different.

You could also do this in automation by using the trigger of a mode change on either thermostat and then a condition template of:

{{ state_attr('climate.thermostat1', 'hvac_action') != state_attr('climate.thermostat2', 'hvac_action') }}

Which results in a true condition, then it executes your actions to disable all thermostats or set one to off with a voice notification or something like that.

Thanks a lot @CO_4X4

I found a solution for it. Your suggestion did not work for me.

“”"

  • name: “TS Cinema Occupancy Status Wifi And BT”
    state: >
    {% if (states(‘sensor.ts_cinema_occupancy_count_ble’) | int + states(‘sensor.ts_cinema_occupancy_count_unifi’) | int) > 0 %}
    Occupied
    {% else %}
    Unoccupied
    {% endif %}

  • name: “TS BF HVAC Heat Cool Conflict”
    state: >
    {% if (((states.climate|selectattr(‘entity_id’,‘contains’,‘climate.bf_ac’)|selectattr(‘state’,‘eq’,‘cool’)|list|count)| int) + ((states.climate|selectattr(‘entity_id’,‘contains’,‘climate.bf_ac’)|selectattr(‘state’,‘eq’,‘dry’)|list|count)| int)) > 0 and (((states.climate|selectattr(‘entity_id’,‘contains’,‘climate.bf_ac’)|selectattr(‘state’,‘eq’,‘heat’)|list|count)| int) + ((states.climate|selectattr(‘entity_id’,‘contains’,‘climate.bf_ac’)|selectattr(‘state’,‘eq’,‘heat_cool’)|list|count)| int)) > 0 %}
    AC Conflict BF
    {% else %}
    No Conflict BF
    {% endif %}

  • name: “TS GF HVAC Heat Cool Conflict”
    state: >
    {% if (((states.climate|selectattr(‘entity_id’,‘contains’,‘climate.gf_ac’)|selectattr(‘state’,‘eq’,‘cool’)|list|count)| int) + ((states.climate|selectattr(‘entity_id’,‘contains’,‘climate.gf_ac’)|selectattr(‘state’,‘eq’,‘dry’)|list|count)| int)) > 0 and (((states.climate|selectattr(‘entity_id’,‘contains’,‘climate.gf_ac’)|selectattr(‘state’,‘eq’,‘heat’)|list|count)| int) + ((states.climate|selectattr(‘entity_id’,‘contains’,‘climate.gf_ac’)|selectattr(‘state’,‘eq’,‘heat_cool’)|list|count)| int)) > 0 %}
    AC Conflict GF
    {% else %}
    No Conflict GF
    {% endif %}

  • name: “TS FF HVAC Heat Cool Conflict”
    state: >
    {% if (((states.climate|selectattr(‘entity_id’,‘contains’,‘climate.ff_ac’)|selectattr(‘state’,‘eq’,‘cool’)|list|count)| int) + ((states.climate|selectattr(‘entity_id’,‘contains’,‘climate.ff_ac’)|selectattr(‘state’,‘eq’,‘dry’)|list|count)| int)) > 0 and (((states.climate|selectattr(‘entity_id’,‘contains’,‘climate.ff_ac’)|selectattr(‘state’,‘eq’,‘heat’)|list|count)| int) + ((states.climate|selectattr(‘entity_id’,‘contains’,‘climate.ff_ac’)|selectattr(‘state’,‘eq’,‘heat_cool’)|list|count)| int)) > 0 %}
    AC Conflict FF
    {% else %}
    No Conflict FF
    {% endif %}

  • name: “TS SF HVAC Heat Cool Conflict”
    state: >
    {% if (((states.climate|selectattr(‘entity_id’,‘contains’,‘climate.sf_ac’)|selectattr(‘state’,‘eq’,‘cool’)|list|count)| int) + ((states.climate|selectattr(‘entity_id’,‘contains’,‘climate.sf_ac’)|selectattr(‘state’,‘eq’,‘dry’)|list|count)| int)) > 0 and (((states.climate|selectattr(‘entity_id’,‘contains’,‘climate.sf_ac’)|selectattr(‘state’,‘eq’,‘heat’)|list|count)| int) + ((states.climate|selectattr(‘entity_id’,‘contains’,‘climate.sf_ac’)|selectattr(‘state’,‘eq’,‘heat_cool’)|list|count)| int)) > 0 %}
    AC Conflict SF
    {% else %}
    No Conflict SF
    {% endif %}
    “”"