#Playing Response from Same Voice Assistant
1 messages · Page 1 of 1 (latest)
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
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.
You have device ID in the trigger, when it's triggering. Check the trace.
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")
}}