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…
- Alexa Media Player (GitHub - alandtse/alexa_media_player: This is a custom component to allow control of Amazon Alexa devices in Home Assistant using the unofficial Alexa API.)
- Mini Media Player (GitHub - kalkih/mini-media-player: Minimalistic media card for Home Assistant Lovelace UI)
- Auto-Entities (GitHub - thomasloven/lovelace-auto-entities: 🔹Automatically populate the entities-list of lovelace cards)
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
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