Dynamic entities from a tempate in a min_max sensor for avg temp - is it possible?

How do I calculate the mean of a list of dynamic entities? Tried to create a helper using a template instead of hard coded entity Id’s but it did not work. Any suggestions?

- platform: min_max
  name: "Downstairs Temperature"
  type: mean
  entity_ids: |
    {% set temp = ['Bedroom','Bathroom','Parents Room','Family Room', 'Nook', 'Kitchen', 'Dining Room', 'Living Room', 'Office Room']
      | map('area_entities') 
      | sum(start=[]) 
      | select('match', 'sensor')
      | select('search','temperature') 
      | reject('search','esp')
      | list
    %}   
    {{ temp | join(', ') }} 
  round_digits: 1