I found a solution that removes the need for a helper. I use the template directly in the automation:
alias: pump-rdc-on-off
description: >-
Turn on or off the ground floor pump when heat is required or not.
triggers:
- trigger: state
attribute: hvac_action
entity_id:
- climate.r_hall_porte_thermostat
- climate.r_hall_fond_thermostat
- climate.r_bureau_thermostat
- climate.r_cuisine_thermostat
- climate.r_salon_thermostat
- climate.r_manger_thermostat
- climate.r_toilet_rdc_thermostat
actions:
- alias: turn on if at least 1 climate entity is heating, off otherwise
service_template: >-
switch.turn_{{ 'on' if (label_entities('heating-zone-rdc') |
select('is_state_attr', 'hvac_action', 'heating') | select('is_state',
'heat') | list | length > 0) else 'off' }}
target:
entity_id: switch.pump_rdc
mode: single
It would have been better if I didn't need to explicitly list the climate entities in the trigger section, but the list will never change anyway, so it's fine. Reducing the number of "objects" to know about is more beneficial in my opinion.
If I need to use the same group of climate entities here and there, I'll go back to grouping them in a helper.