Send a notification via the Lovelace-UI to your Alexa-Devices. You can create an elements card with an input select and a input text like shown in the picture below. You can specify if the messages should be delivered via “TTS” or “Announce” an which devices should be selectable for the notifications. No Nabu Casa or exposing your HA-Instance to the internet required.
Requirements
Alexa Media Player must be installed. It can be installed from the Home Assistant Community Store (HACS)
Input text must be created. This contains the message.
Input select must be created. This contains the target. The options contain the alexa devices which should be allowed to be selected to play the notification. The options can contain the friendly Name, Serial Number, entity_id, or Home Assistant Group.
Select the target (or left the right one if already selected)
Type the message in
Hit enter! After this the automation is fired.
Blueprint:
blueprint:
name: Alexa Media Player TTS/Announce from Lovelace UI
description: Send a notification (TTS/Announcment) via the Lovelace-Ui with the help of a input select and input text. Uses the TTS component from Alexa Media Player which can be installed from the Home Assistant Community Store (HACS).
domain: automation
input:
message:
name: Message of the notification (Input Text)
description: Input text where the message comes from
selector:
entity:
domain: input_text
target:
name: Target of the notification (Input Select)
description: The alexa device where the notification should be played. Must be in a input select. Options can be the Friendly Name, Serial Number, entity_id, or Home Assistant Group.
selector:
entity:
domain: input_select
announce:
name: Is announcment
description: Specify if announce-feature should be used. If not, the notification will be a standart text-to-speech.
default: false
selector:
boolean:
mode: queued
max_exceeded: silent
variables:
message_to_say: !input message
target_for_message: !input target
is_announce: !input announce
trigger:
- platform: event
event_type: state_changed
event_data:
entity_id: !input message
condition: []
action:
- service: notify.alexa_media
data:
message: "{{ states(message_to_say) }}"
data:
type: >
{% if is_announce %}
announce
{% else %}
tts
{% endif %}
target:
- "{{ states(target_for_message) }}"
Changelog
2021-01-10: Set default value to the announce input
How do you create the requirements. I have Alexa installed via HAS (and it works fine)… but the input text and input selection is a big mystery to me. When selecting them, no choices are available?
I think you forgot to set up the input text and input select. To create them via UI you have to navigate to settings --> helpers. See the next missing steps below.
Input text must be created. You have not to put any specifiy in, just make shure to name it properly so you can find it.
Input select must be created. The options contain the alexa devices which should be allowed to be selected to play the notification. The options can be named with the friendly Name, Serial Number, entity_id, or Home Assistant Group. Make shure to make this right, cause a simple misspell or something similiar can break the blueprint
Put the created input text and input select anywhere in your lovelace UI from where you can access it. I have done it via a elements card
Now set up the blueprint and make a automation with it.
If you have created the helpers, it should be pickable in the blueprint, but like above mentioned it only works right if you put the right options in the input select.
Edit: Sending from a desktop browser works fine… upon hitting the return/enter key, the message is sent… but I can’t seem to make them send from a mobile… pressing the return key on the mobile ‘iOS Safari’ doesn’t seem to send anything?
Thanks for Replying @Gav_in and @swa72. I dont use ios so I havent this problem, in Android it works fine with the shown parts. The way they showed should work perfectly fine.
Technically it should be triggerd when the state changes in the input text. This should happen when you change the text and hit the return/enter key (So if you hit enter without changing the message, it doesnt trigger). Dont know why this doesnt work on ios or safari. I would guess that Apple seems to avoid architectural standards again
I dont have nabu casa, so i dont know and cant test the services behind them. But in Theory this should be possible, just replace the service part with the service provided below. As said i cant test them, so you have to try. As a drawback you have to put the entity ids into the inoput select i think.
Here’s your blueprint modified to work with Nabu Casa, as well as removed the bug that if you click anywhere in lovelace it plays the text.
blueprint:
name: Alexa Media Player TTS/Announce from Lovelace UI - Cloud
description: Send a notification (TTS/Announcment) via the Lovelace-Ui with the
help of a input select and input text. Uses the TTS component from Alexa Media
Player which can be installed from the Home Assistant Community Store (HACS).
domain: automation
input:
message:
name: Message of the notification (Input Text)
description: Input text where the message comes from
selector:
entity:
domain: input_text
target:
name: Target of the notification (Input Select)
description: The alexa device where the notification should be played. Must
be in a input select. Options can be the Friendly Name, Serial Number, entity_id,
or Home Assistant Group.
selector:
entity:
domain: input_select
announce:
name: Is announcment
description: Specify if announce-feature should be used. If not, the notification
will be a standart text-to-speech.
default: false
selector:
boolean: {}
source_url: https://community.home-assistant.io/t/alexa-tts-announcement-from-lovelace-ui-and-without-nabu-casa-alexa-media-player/259980
mode: queued
max_exceeded: silent
variables:
message_to_say: !input 'message'
target_for_message: !input 'target'
is_announce: !input 'announce'
trigger:
condition: []
action:
- service: notify.alexa_media
data:
message: '{{ states(message_to_say) }}'
data:
type: tts
target: '{{ states(target_for_message) }}'