Dynamic Group of Sensors?

Hi all,

I’m trying to make a group of sensors that are dynamic based on a collection of switches in the UI, that way I am able to have an average temperature value that is made up only of the temperature sensors enabled.

I can’t find an easy way to do this without doing something with group.add/group.remove.

Any ideas?

I have no clue how to answer precisely…but this may help you as an example

  {% for x in (states.sensor
  |rejectattr('entity_id', 'search', '_updated|test')
  |selectattr('attributes.device_class', 'defined')
  |sort(attribute='last_changed', reverse=true))[0:10] %}
{{x.entity_id}}
{% endfor %}