How to know which alexa called the script

Hello guys,
I have two alexas, one in my room and one in the tv room. I want to make a script or automation, for example, turn down the volume (without saying the name of tv) or play/pause the movie, and based on which alexa called the script, home assistant will to the action on that TV based on location of that alexa.
Is that possible?

Are you using Node Red within Home Assistant currently because there is a Node Red pallet of nodes that can do that? There is a great thread here about someone who uses it for room-aware Alexa commands. I have done similar room-aware commands using that Node Red pallet but with Hubitat instead of Home Assistant.

If you use Alexa Media Player there is a last_alexa sensor

and this is probably a whole 'nother can of worms but i realized my example automation wouldn’t make sense without explaining… i use a “virtual light” which was my initial method of connecting my HA/Emulated Hue/and Alexas… i do realize there are other methods of accomplishing this with routines/Alexa Smart Home Skill… but too many of my automations i have use this and have not yet changed alot of them… it involves using an Alexa routine to trigger the “virtual bulb” which HA watches for brightness level changes and HA use that brightness to trigger the needed automation…

############################### FIRETV TURN ON
- alias: FireTV Turn On
  id: d75d7630-421d-4ebc-8de7-a7047b77069b
  trigger:
  - entity_id: sensor.alexa_virtual
    platform: state
    to: '18'
  action:
    - service: light.turn_off
      entity_id: light.alexa_virtual
    - delay: '00:00:01'
    - service: media_player.turn_on
      data_template:
        entity_id: >-
          {% if is_state('sensor.last_alexa','media_player.living_room_echo') %}
            media_player.fire_tv
          {% elif is_state('sensor.last_alexa','media_player.echo_show') %}
            media_player.fire_tv
          {% elif is_state('sensor.last_alexa','media_player.bedroom_dot') %}
            media_player.brian_s_fire_tv_stick
          {% elif is_state('sensor.last_alexa','media_player.girls_dot') %}
            media_player.girls_fire_tv
          {%-endif-%}
    - delay:
        milliseconds: 500
    - service: light.turn_off
      entity_id: light.alexa_virtual
1 Like

That’s awesome… Thanks @Stephenn and @Bartem . I will analyze which one is easier for what I want to to do.