#Detecting which voice assistant heard a command

1 messages · Page 1 of 1 (latest)

pearl cedar
#

I'm using the HA Voice Assistant Preview Edition and trying to create an automation where I want, as a condition, which voice assistant heard the command. The automation will wait for the command "turn on the lights", it will then determine which voice assistant heard the command, and if it is the one for that room it will turn on the primary light in the room.

I have the basic automation:

`alias: Great Room - Turn on the lights
description: ""
triggers:

  • trigger: conversation
    command: Turn on the lights
    actions:
  • action: switch.turn_on
    metadata: {}
    data: {}
    target:
    entity_id: switch.ceiling_light
    mode: single`

I am struggling to figure out a way to determine if the command was issued to the great room voice assistant. My understanding is that Alexa and Google Assistant support an attribute of "last_heard" and "last_command" and I could check those in a template. However, I can't find an equivalent for the voice assistant preview addition.

Any guidance on a way to accomplish this would be greatly appreciated.

Thanks in advance for the help

pearl cedar
shadow olive
#

This command is supported out of the box, and will turn on the lights in the area of the Voice PE. Why are you recreating it?

pearl cedar
#

Thanks @shadow olive . I wasn't aware of that functionality. So maybe my real question should be how do I define the specific light/lights that I want to turn on in a room when the command "turn on the light" or "turn on the lights" is issued. In a large room there might be quite a few light fixtures and I'd like to only turn on specific ones. Thanks again.

shadow olive
#

You can use the name of the light

#

turn the ceiling light on (assuming the light has that name, or it has been given that as an alias)

#

Without providing a specific light or a specific area/floor (like turn on the lights in the kitchen) it will turn on the lights in the same area as the assist satellite

pearl cedar
#

Thanks @shadow olive . I completely understand the ability to turn on a specific light by including its name in the voiced command. I'm trying to provide simplified commands for non-technical users. Hence the idea of "turn on the light" turns on the most commonly used light in a given room where the assist satellite is located. The same holds true for shades where there are multiple shades in a room. A more complex use case is warming up or cooling down a room (make it warmer/cooler voice command) where the room is part of a heating/cooling zone that covers multiple rooms. I could easily implement all of this if I could identify the assist satellite that heard the command in an automation. I'm not sure where I'm overlapping built-in functionality or where I'm trying to do things that aren't directly supported. Thanks again.

shadow olive
#

You can do that, but how will you determine that the most commonly used light/shade is?

shadow olive
#

However, you were trying to use it in the state_attr() function, which expects an entity_id

#

So that won't work

#

You can use area_id(trigger.device_id) to get the area id in which the assist satellite is located

pearl cedar
#

Thanks @shadow olive . That is perfect. In my own home I certainly know what the most commonly used lights, shades, etc. are in a room. I'm trying to think in terms of something that would be easily reusable for other people or if I were to sell my house at some point in the future it would be something that could be easily understood and modified by a future homeowner. Thanks again!

#

Works perfectlt! Thanks again

modern sundial
#

@shadow olive - I'm new to the automations - any chance you can share a template of your configuration - I am also wanting to do something like this