Template sensor to show heating if any room is heating

I have created 5 template sensors to create entities to show the hvac_action (and then use Utility Meter to track time heating). They all work as expected.

I would like to combine the 5 sensors to create 1 sensor that will show heating if any of the rooms are heating. This one I cannot get working…

I have gotten as far as creating YAML that doesn’t break and the sensor ‘Heating Activity’ is created, though it doesn’t work / update if one of the rooms is heating or all of the rooms are idle.

Any suggestions would be much appreciated.

template:
  #Template to get hvac_action as entity and create sensor to show heating if any room is heating
  - sensor:
      - name: Bedroom Heating Activity
        state: "{{ state_attr('climate.bedroom', 'hvac_action') }}"
  - sensor:
      - name: Big Office Heating Activity
        state: "{{ state_attr('climate.big_office', 'hvac_action') }}"
  - sensor:
      - name: Big Room Heating Activity
        state: "{{ state_attr('climate.big_room', 'hvac_action') }}"
  - sensor:
      - name: Little Office Heating Activity
        state: "{{ state_attr('climate.little_office', 'hvac_action') }}"
  - sensor:
      - name: Spare Room Heating Activity
        state: "{{ state_attr('climate.spare_room', 'hvac_action') }}"

  - sensor:
      - name: Heating Activity
        state: >-
          {%- if (states('sensor.bedroom_heating_activity') or states('sensor.big_room_heating_activity') or states('sensor.big_office_heating_activity') or states('sensor.spare_room_heating_activity') or states('sensor.little_office_heating_activity'))==heating-%}heating{%- else -%}idle{%- endif -%}


try Group - Home Assistant

Thanks for the suggestion, I thought that would be the answer but I can’t get it to work for these entities (I have other light groups that work as expected).

No matter what domain I get:

Invalid config for ‘group’ at groups.yaml, line 2: [domain] is an invalid option for ‘group’, check: group->group->[domain]

Share your attempted group config, not just the error.

Or change your sensor to this:

  - sensor:
      - name: Heating Activity
        state: >
          {% if is_state('sensor.bedroom_heating_activity','heating') or
                is_state('sensor.big_room_heating_activity','heating') or
                is_state('sensor.big_office_heating_activity','heating') or 
                is_state('sensor.spare_room_heating_activity','heating') or
                is_state('sensor.little_office_heating_activity','heating') 
          %}
            heating
          {% else %}
            idle
          {% endif %}

Thanks @tom_l, much appreciated. Now I can see where I went wrong!