Get the area of the voice assistant to use in intent_script

Yes it does help actually. Still not 100% what I am after but now I have:

intents:
  PlayerPauseArea:
    data:
      - sentences:
          - "hold the music"
        requires_context:
          area:
            slot: true
intent_script:
  PlayerPauseArea:
    action:
      service: "media_player.media_pause"
      data:
        entity_id: "{{ expand(states.media_player) | selectattr('entity_id', 'in', area_entities(area)) | select('search', 'ma_') |map(attribute='entity_id') | join }}"
    speech:
      text: "Paused"

I love progress! Now to play with it some more so I can either call for a specific player or the area will be recognised but have it all in one intent. BTW the search is used to find the music assistant player as I have prefixed all their entity ids with ma_

1 Like