Custom Intents Using <name>

Hi,

I somewhere found this line of code that lists all available entitites, filters by name and then returns the entity_id. It works perfectly with the FriendlyName.

intent_script:
  StopCover:
    action:
      service: "cover.stop_cover"
      data:
        entity_id: "{{ states.cover | selectattr('name', 'in', name) | map(attribute='entity_id') | list | first | default }}"
    speech:
      text: "{{name}} fermata!"

you probaly want to change states.cover to states.person

I am now trying to understand how to use aliases since the intent is recognised when useing aliases but the line of code I just provided does not work.

There is no attribute Alias so probably there is something like for Area where you filter the entities with this:

selectattr('entity_id', 'in', area_entities({area}))

Anyone on how to use entity alias in templates?