Alexa Announcements Dashboard Card & Automation... Alexa Media Player + Auto-Entities + Mini Media Player

Automatically lists/displays all your Alexa devices allowing you to send voice announcements by simply entering the message (or selecting from pre-defined list) and clicking on the icon for the Alexa device you want to send to.

Shows what is currently playing and provide a few basic controls (volume, start/stop, etc)

*** REQUIREMENTS ***

Integrations…

Automation (YAML below)…
Sync Alexa Announcement Text & Dropdown
– handles the pre-defined selections and updating the text as needed

Helper Entities…
input_select.alexa_announcement_text
– for creating your pre-defined messages

input_text.alexa_announcement_text
– for directly entering the message. what is here will be announced when you click the icon on the device list below

Script…
script.alexa_announcement_routing (see below)

Auto-Entities must have the main ‘include’ be media_player domain. The mini-media-player depends on this, and then you need to exclude any entities you dont want in the list… like google, etc. I’ve already done several of these in the code. ‘This Device’ is auto generated by Alexa, since it isn’t needed.


type: vertical-stack
cards:
  - type: entities
    title: Alexa Announcement
    entities:
      - entity: input_select.alexa_announcement_text
        name: Select Predefined Message
      - entity: input_text.alexa_announcement_text
        name: Current Message
        secondary_info: "[[[ return states['input_text.alexa_announcement_text'].state ]]]"
  - type: custom:auto-entities
    show_empty: false
    card:
      type: grid
      columns: 1
      square: false
    card_param: cards
    filter:
      include:
        - domain: media_player
          options:
            type: custom:mini-media-player
            group: false
            artwork: material
            info: scroll
            hide:
              power: false
            tap_action:
              action: call-service
              service: script.alexa_announcement_routing
              service_data:
                target: this.entity_id
                message: "{{ states('input_text.alexa_announcement_text') }}"
      exclude:
        - state: unavailable
        - integration: cast*
        - integration: android*
        - attributes:
            friendly_name: "*Jennifer*"
        - attributes:
            friendly_name: "This Device*"
        - options: {}
          entity_id: media_player.spotifyplus*
        - options: {}
          entity_id: media_player.musiccast*
        - options: {}
          entity_id: tv*
grid_options:
  columns: full

AUTOMATION…

alias: Sync Alexa Announcement Text & Dropdown
triggers:
  - entity_id: input_select.alexa_announcement_text
    trigger: state
  - entity_id: input_text.alexa_announcement_text
    trigger: state
actions:
  - choose:
      - conditions:
          - condition: template
            value_template: |
              {{ trigger.entity_id == 'input_select.alexa_announcement_text' 
                 and states('input_select.alexa_announcement_text') != '---' 
                 and states('input_select.alexa_announcement_text') != 'Select...' }}
        sequence:
          - target:
              entity_id: input_text.alexa_announcement_text
            data:
              value: "{{ states('input_select.alexa_announcement_text') }}"
            action: input_text.set_value
      - conditions:
          - condition: template
            value_template: |
              {{ trigger.entity_id == 'input_text.alexa_announcement_text'
                 and states('input_text.alexa_announcement_text') != states('input_select.alexa_announcement_text')
                 and states('input_text.alexa_announcement_text') != '' }}
        sequence:
          - data:
              entity_id: input_select.alexa_announcement_text
              option: "---"
            action: input_select.select_option
mode: single

SCRIPT (script.alexa_announcement_routing) …

alias: Alexa Announcement Routing
mode: single
description: ""
sequence:
  - data:
      message: "{{ announcement }}"
      target: "{{ target_device }}"
      data:
        type: announce
    action: notify.alexa_media
variables:
  announcement: "{{ states('input_text.alexa_announcement_text') }}"
  target_device: "{{ target }}"
1 Like

“script.alexa_announcement_routing” not found" message is coming. Any suggestion !

If you followed the directions exactly then maybe the Alexa Media Player integration did not install properly. I suggest making sure you completed all steps and maybe remove/reinstall the required Integrations

Yogi1 is correct, it looks like you forgot to share the configuration for the script called by your card’s tap action… it has nothing to do with AMP installation.

DOH! I’m sorry, I totally spaced it. Guess you’re the only one that has tried this :wink:

I updated the first post with the script.

I hope you enjoy it. It works nicely for us.

For help with that integration, its best to post your question in the thread for Alexa Media Player integration

So nice of you, Thank you for sharing script. :grinning:

1 Like