#Playing Response from Same Voice Assistant

1 messages · Page 1 of 1 (latest)

zenith wedge
#

I have multiple voice assistants in my house. I've created a script that reads the weather forecast. However, it needs a target media player. Ideally I'd like that to be the same media player (i.e., voice assistant) that initiated the request.

Is there a way to do that?

versed cargo
# zenith wedge I have multiple voice assistants in my house. I've created a script that reads t...

what is your current complete work flow?

instead of using a script you could use an automation. triggered by a sentence trigger then instead of using action to output to a media player you can have the generated response set as the responce to the sentence trigger.

e.g:
trigger: "what is the weather"
action: do some stuff to generate report and set it to a variable
action: set conversation response to the variable

zenith wedge
#

I started with a script, but then I migrated to an automation that uses a sentence. In my situation, I typically have a voice assistant and a speaker (e.g., Sonos) in the same room. I want to voice assistant to accept the voice command, but then I want to output it to the corresponding speaker. So far, what I've done is created a sentence based trigger that takes the command (e.g., what is the weather), sends a prompt to Gemini, captures the response, and then outputs it to a media player controlled by a variable named "target_player". The "target_player" variable is a template sensor that stores the media player that corresponds to the most recently activated voice assistant.

The good news is that it works, but it seems clunky.

potent jetty
#

You have device ID in the trigger, when it's triggering. Check the trace.

fleet pilot
#
target_player }}"
              auto_play: true
variables:
  satellite_player_map: |
    {{
      {
        "assist_satellite.home_assistant_voice_09d144_assist_satellite": "media_player.mass_office_speaker",
        "assist_satellite.vaca_70104da20": "media_player.mass_kitchen_hub",
        "assist_satellite.satellite1_c41d44_assist_satellite": "media_player.mass_main_bedroom",
        "assist_satellite.satellite1_d09ed8_assist_satellite": "media_player.mass_living_room"
      }
    }}
  target_player: |
    {{
      satellite_player_map.get(trigger.satellite_id, "media_player.default_speaker")
    }}