Examples: Broadcasting with a custom card - alandtse/alexa_media_player GitHub Wiki
This is the custom card:
https://github.com/gadgetchnnel/lovelace-text-input-row
Create a broadcast script:
instant_message:
sequence:
- service: notify.alexa_media
data_template:
target: "{{ states('input_select.message_target') }}"
data:
type: announce
message: "{{ states('input_text.message_text') }}"
Create an input_text
where you can enter the text which has to be broadcasted:
input_text:
message_text:
name: Alexa message text
initial: 'Enter your text here'
And make another input_select
for the target:
input_select:
message_target:
name: Alexa message target
options:
- "media_player.kitchen" # Echo device
- "media_player.all_alexa_devices" # Device group
initial: "media_player.all_alexa_devices"
icon: mdi:speaker-wireless
The lovelace code for the input row card:
entities:
- entity: input_text.message_text
name: Alexa message text
type: 'custom:text-input-row'
- entity: input_select.message_target
name: Alexa message device
- action_name: Send
icon: 'mdi:voice'
name: ' '
service: script.instant_message
type: call-service
type: entities
In this example I created a speaker group in Alexa called "All Alexa devices" and added all the speakers to it, which should be used when broadcasting. You can create different groups in Home Assistant too, which can also be used.