Can this be done ? - Same spoken phrase, different device affected

I’m thinking about extending the coverage of my voice assistants and having three across the house. These would be esphome based devices, probably the esp32-s3-box3.

If I were to sit in one room and say ‘turn on the lights’, I’d want the lights in that room to turn on.

If I were in another room, with another s3-box, and said the same sentence, then the lights in that room would turn on instead, and not in the first room.

I think I can do this via an automation if I can detect the entity_id of the device that triggered the assist, then use a choose condition to turn on the revelant entities.

Is this possible ?

Just read up this, which will work, unless more than one device is ‘assisting’ at the same time:-

For ESPHome based satellites, you can monitor the assist_in_progress binary_sensor to determine which satellite sent the request.

Any other ideas ?

This is standard functionality. The connection between the assistant and the devices is determined through the Area assignments.

I did wonder. I’ve never really bothered with areas before, but now it seems this could be the thing that pushes me over the line to learn more about.

I have since figured out how to do it using an automation and the assist_in_progress binary_sensor, but if I can get what I need out of the box, then even better still.

So I’ve added a light group to an area, and added the voice assistant device to the same area. I can now say 'turn off the {area name} lights and it works perfectly, knowing what lights are assocated to that area.

However, I still can’t say ‘turn off the lights’ and for HA to know which room I am talking about, based on the assocation of the assist device and the area.

I’ve worked around this by using an automation that checks for which device was activated and this works fine, but am I still missing something ?

This is my workaround:-

alias: Voice - Multi-room Lights On/Off
description: ""
trigger:
  - platform: conversation
    command:
      - "turn on [the] lights "
      - "[turn] [the] lights on"
    id: "on"
  - platform: conversation
    command:
      - "turn off [the] lights "
      - "[turn] [the] lights off"
    id: "off"
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: binary_sensor.esp32_s3_lounge_assist_in_progress
            state: "on"
        sequence:
          - if:
              - condition: trigger
                id:
                  - "off"
            then:
              - service: scene.turn_on
                metadata: {}
                target:
                  entity_id: scene.lounge_all_off
            else:
              - service: scene.turn_on
                metadata: {}
                target:
                  entity_id: scene.lounge_normal_mode
          - set_conversation_response: I've turned the lights {{trigger.id}}
mode: queued

I’ll add more choices as I need them, so far there is only one as a proof of concept.

But you can. Have you assigned zones to your esp32-s3-box3?

You can see all the command options here

Yes, I’ve added the box3 to the same area as the lights. I’ll try it again later and use the debug option to see whats going on.

image

Could there be an issue because I’ve only added a light group helper ?

I’m not sure how to interpret the sentences in that file, I am used to a format from the assist help pages that looks like this:-

(set|change) {media_player} volume to {volume} [percent]

So its unclear what the items in the <brackets> signify… but I do notice the word ‘the’ is missing from the sentences ?

(although the sentence ‘turn on THE lounge lights’ works.)

Also… if I say ‘turn off all the lights’, it turns off every light in the house, not just in the area the s3 is in.

brackets is expansion rules. This is part of the standard syntax to shorten the length of phrases. The options can be viewed here

That’s right, this phrase corresponds to the command for the whole house

try “turn off the lights”

I’ll give that a go.
I’m still curious why ‘turn off all the lights’ is affecting the whole house, when it also appears to be an area specific phrase:-

# Turn off lights in the same area as a satellite device
- sentences:
    - "<turn> <all> <light> off <here>"
    - "<turn> <light> off <here>"
    - "<turn> <all> <light> <here> off"

The phrases are different, you need to compare them more carefully

Ah yes, it appears to be where I am placing the word ‘off’ for one.
Those two links you’ve sent have been super useful in my understanding of how the sentence construction works.

‘turn off the lights’ also doesn’t seem to match any of the area based phrases either.

The only one without <here> is:

"<turn> <light> off"

Which with the expansions, could be:-

(turn|switch|change) [the] (light|lights|lighting) off

which becomes (for me), turn the lights off, NOT turn off the lights (which is what I am saying to my device).

Although in this video (admittedly 7 months old, he is also saying ;turn off the lights’) and its working based on the area.

EDIT:-

Ignore the above… there is one which should work for me:-

"<turn> off <light>"

I just didnt look far enough down.

I’ll do some more testing when i get home.