Should be:
type: custom:auto-entities
card:
type: custom:mini-graph-card
filter:
template: >-
{{ states.sensor |
selectattr('entity_id','search','[xiaomi,mijia]_.*_co2') |
map(attribute='entity_id') |
list }}
Here the destination card has the “entities” option - which is filled by generated list of entities.
BUT - it may be not just a list, it could be a list of DICTS:
template: >-
{% for ENTITY_ID in states.sensor | selectattr('entity_id','search','[xiaomi,mijia]_.*_co2') | map(attribute='entity_id') | list -%}
{{
{
'entities': ENTITY_ID,
'name': 'xyz'
}
}},
{%- endfor %}
So, in your example you misplaced a comma.
My example with m-e-r was exactly about generating a list of dicts.