How to find entity_id using the Voice Alias using templates?

I was facing the same problem and found my own solution. I don’t know if there is any ‘offical’ one yet.

So I noticed that in .storage/core.entity_registry there are all information we need. With the following shell_command you can extract the entity_ids and aliases:
get_entity_alias: jq '[.data.entities[] | select(.options.conversation.should_expose == true and (.aliases | length > 0)) | {aliases, entity_id}]' ./.storage/core.entity_registry

I’ve then made a sensor:

  #Sensor für Zuordnung von Alias Namen zu Entity-IDs (Update über Neustart oder Service homeassistant.update_entity)
  - trigger:
      - platform: homeassistant
        event: start
    action:
      - service: shell_command.get_entity_alias
        data: {}
        response_variable: result
    sensor:
      - name: "Assist: Entity IDs mit Alias"
        state: '0'
        attributes:
          entities: "{{result.stdout}}"

And there you have it. In your script you can then use something like this:

variables:
  area: "{{area}}"
  area_id: "{{area_id(area) or None}}"
  name: "{{name}}"
  entity_id: >-
    {{ (state_attr('sensor.assist_entity_ids_mit_alias','entities') |
    selectattr('aliases', 'contains', name) | map(attribute='entity_id') |
    list)[0] or None }}