Your YAML anchor idea is great (for “static” groups)! Now I can:
group:
my_group:
entities: &my_group
- sensor.aaa
- sensor.bbb
automation:
- trigger:
- platform: state
entity_id: *my_group
action:
- ...
# or where a list of entity ids are required:
for_each: *my_group # for static groups this is the equivalent of '{{ expand("group.my_group") | map(attribute="entity_id") | list }}'