#How can I get the entity id from the alias in an automation?

1 messages · Page 1 of 1 (latest)

autumn adder
#

Supposing I have an automation with a custom trigger sentence:

(set|change) [the] garage tv [input] to {input}

How can use the value of input to lookup the entity for which it is aliased.

for example:

#

I have the room/area 'garage' defined as well, per haps i'm doing something wrong?

cobalt spruce
#

You'll have to hard-code a map for now, unfortunately

autumn adder
#

ah balls

astral tusk
#

I usually use something like this in my intents, wonder if you could use this or make it work with aliases;

        {{ states.media_player | selectattr('name', 'match', name) | selectattr('entity_id', 'in', integration_entities('mass')) | map(attribute='entity_id') | list | first | default }}
#

Hmm don't think it would work, seems the above only works on the device name, doesn't include aliases. Don't think there's an alias attribute to query either.

#

Seems someone managed to figure this out here, though it's a bit hacky lol https://community.home-assistant.io/t/how-to-find-entity-id-using-the-voice-alias-using-templates/576655/10

harsh fulcrum
autumn adder
#

getting the entity by the alias seems like good idea

autumn adder
#

I did figure out though that the voice assistant seems to use the area if it's found in the voice prompt, without it needing to be in the entity alias.

for example i have a button entity aliased to "playstation", and the area is "garage", and the phrase "turn on the playstation in the garage" has the desired effect.

#

This button selects the appropriate HDMI input on my tv, but doesn't turn the TV on.

#

My need to get the entity id from the alias is not as pressing as it once was, but it does seem like a missing feature 😉