Loop thru sensors

I have created over 20 template sensors and need to use them in automation as condition. Is there any way to loop thru them or is the only way to add each of them as condition.

The sensors are named sensor.dals_* and the condition should be meet if any of them have the state “on”.

The easiest way is to put them all in a group and test if the group is on (state condition).

I was thinking something like this.

{% for state in states.sensor %} {{ state.entity_id }}={{ state.state }}, {% endfor %}

Why overcomplicate it?

condition:
  - condition: state
    entity_id: group.dals
    state: 'on'

Are the number of sensors likely to change often?

Maybe, I’m not sure.