OK, i’m not sure that what i am trying to do is possible (or at least whether i would have to create an amazon skill that is way beyond my capabilities)
i have trawled this forum and the internet, but am unable to find anyone asking this question (not usually a good sign!)
I have 6 alexa speakers around the house
I have a variety of alexa routines that call scripts in home assistant. those scripts often respond with TTS announcements.
e.g.
“alexa, how long is left on the dishwasher” will trigger a script that checks my dishwasher integration and will respond with the following template
service: notify.alexa_media
data:
target: media_player.kitchen_dot
message: |-
{% if is_state('sensor.dishwasher', 'Finished') %}
the dishwasher does not appear to be running, i believe it last finished {{ ( (now() | as_timestamp ) - ((state_attr('automation.dishwasher_finished','last_triggered')) | as_timestamp ) ) | timestamp_custom("%-H", 0) }} hours and {{ ( (now() | as_timestamp ) -
((state_attr('automation.dishwasher_finished','last_triggered')) | as_timestamp ) ) | timestamp_custom("%-M", 0) }} minutes ago
{% else %}
The time remaining on the dishwasher is {{ state_attr('sensor.dishwasher', 'remaining_minutes') }} minutes
{%endif%}
data:
type: tts
this works brilliantly (and has high WAF). it’s simple as i will almost only be asking this question while in the kitchen, so specifying the target a my kitchen dot is uncontroversial.
however if I want to ask alexa ‘where are the car keys’ or any variety of scripts that i use, i want the TTS announcement to only go to the alexa speaker from which the routine was triggered. this might be my front room, the hallway, the bedroom, the nursery…
I appreciate that i can announce the answer to all (or specific groups of) alexa devices, but this is impractical and would require a pitfall ridden quantity of conditions to second guess where i might want the answer so as not to wake the baby in her room or disrupt a work meeting in the office… espresence is pretty good, but i wouldn’t rely on it not to wake the baby if it thinks i’m in the nursery…
I don’t really know enough about how alexa sends commands to home assistant, and it may be that home assistant has no way of knowing which speaker was used in the first place, but is there any way of sending and then utilising some kind of marker/mangle with the command to launch the home assistant ‘scene’ (script), which i could then use to specify a variable target media_player
thanks/sorry for the dumb question.