Dynamic (or auto-)entities list

Hi all, thanks for the great community support. My latest learning question: is there a way to something like below to avoid, in this example, having to hard code a list of light entities? Below result is a correct list, but it throws up an error as I imagine its not the expected format for the yaml.

- platform: group
  name: "All Lights"
  unique_id: all_lights
  entities: >-
    {{ states.light 
        | rejectattr('state', 'eq', 'unavailable') 
        | rejectattr('entity_id', 'match', '.*_group.*') 
        | rejectattr('entity_id', 'match', '.*_lamp.*') 
        | map(attribute='entity_id') | list 
    }}

(I’ve tried variations with | join('\n -') for example but no success and stabbing in the dark.)

It’s got nothing really to do with the expected format of the yaml. It has to do with templates for group members aren’t supported.

If it is supported it will say so in the docs for the configuration entries.

Ok, thanks.