-
Notifications
You must be signed in to change notification settings - Fork 17
Examples Alexa
-
Examples Alexa
- Send a custom message only for Alexa
- Alexa Boolean option
- Media player
- Media player list
- Volume
- Type tts
- Type announce
- Send a sound from home assistant
- Last Alexa
- Sensor Notifier Player Alexa
- Send tts and push message at the same time
- Language and voice-id
- SSML
- Prosody and whisper
- Audio
- Audio 2
- Audio from local
- Wait time
- Media content
- Media content extra
- Notifier
- Mode
- Priority
- Event ID
service: script.my_notify
data:
notify: False
alexa:
message: Speak only Alexa
Activate Alexa and send the same message as the text notifications.
service: script.my_notify
data:
message: Primary message for text notifications.
alexa: True
service: script.my_notify
data:
message: Primary message for text notifications.
alexa:
media_player: Sala # CHANGE ME
You can enter a list of media players, using the name, entity or both.
service: script.my_notify
data:
message: Primary message for text notifications.
alexa:
media_player: Sala, Studio, media_player.sala # CHANGE ME
Set the preferred volume for this notification.
service: script.my_notify
data:
message: Set the volume to 50%.
alexa:
volume: 0.5
service: script.my_notify
data:
message: Set type to tts.
alexa:
type: tts
service: script.my_notify
data:
message: Set type to announce.
alexa:
type: announce
Note the following requirements and limitations The file used for this test can be found in the sounds folder ! still work?
service: script.my_notify
data:
alexa:
message: test
ssml: true
audio: https://YOURDOMAIN.duckdns.org/local/comic.mp3
In this example, you need the sensor.last_alexa
service: script.my_notify
data:
alexa:
message: "Abracadabra! This is, the last alexa sensor"
media_player: Last Alexa
Of course, you can use the sensor in the package or your own specific one, provided that it has in the state one or more media player entities.
service: script.my_notify
data:
alexa:
message: "ding ding ding. This is the notifier sensor"
media_player: sensor.notifier_player_alexa
service: script.my_notify
data:
alexa:
message: Alpha one-two, this is X-ray two-three, ROGER, OUT
title: Push notifiction
push: true
If SSML is not active, you will hear Alexa’s normal voice.
service: script.my_notify
data:
alexa:
message: "Houston, we have a problem!"
language: en-US
voice: Matthew
If SSML switch is not active, the ssml option can force activation.
service: script.my_notify
data:
alexa:
message: "Houston, we have a problem, here!"
ssml: true
language: en-US
voice: Joey
If whisper is true, it will apply a whispering effect to the speech.
service: script.my_notify
data:
alexa:
message: >
Parlo piano e a bassa voce. Sono le 11 Buonanotte e sogni d'oro!
ssml: true
whisper: true
rate: 80
ssml_volume: 4.1
type: tts
volume: 0.4
Audio Amazon Sounds
service: script.my_notify
data:
alexa:
ssml: true
audio: soundbank://soundlibrary/foley/amzn_sfx_clock_ticking_01
service: script.my_notify
data:
alexa:
ssml: true
audio: >
<audio src="soundbank://soundlibrary/home/amzn_sfx_doorbell_01"/>
service: script.my_notify
data:
alexa:
media_player: media_player.echo_dot
message: >
Test domain clodflrare <audio src="https://CHANGE_ME_YOUR_DOMAIN/local/comic.mp3"/>
You can use wait_time to increase the pause between messages. Useful for long and complex templates, or for sounds.
service: script.my_notify
data:
alexa:
ssml: true
wait_time: 1
push: true
title: Segnale Orario
message: >
Cucù! Sono le {{now().strftime("%H:%M")}}, accipicchia!
audio: soundbank://soundlibrary/foley/amzn_sfx_clock_ticking_01
For now, the media content is out of the message queue. There is no way to know the duration or the end of the playback
service: script.my_notify
data:
alexa:
media_content_id: Alexa.GoodMorning.Play
media_content_type: sequence
media_player: studio, last alexa
service: script.my_notify
data:
notify: false
alexa:
media_content_id: taylor swift
media_content_type: AMAZON_MUSIC
extra: 30
service: script.my_notify
data:
alexa:
media_content_id: Alexa.FlashBriefing.Play
media_content_type: sequence
notifier: alexa_media_sala # CHANGE ME
service: script.my_notify
data:
alexa:
mode: "{{is_state('sun.sun', 'above_horizon')}}"
message: >-
message test with condition
type: announce
media_player: last alexa
service: script.my_notify
data:
call_no_annuncio: true
alexa:
priority: true
message: This message will always play
automation:
- alias: Basement light left on for 10 minutes
trigger:
platform: state
entity_id: light.basement_light
to: "on"
for:
minutes: 10
action:
- service: script.my_notify
data:
title: "Basement light left on"
message: "The Basement light has been on for a long time. Do you want me to turn it off?"
alexa:
voice: giorgio
event_id: "basement_light_event"
media_player: last_alexa
- alias: Turn off Basement light via event
trigger:
platform: event
event_type: alexa_actionable_notification
event_data:
event_id: basement_light_event
event_response: ResponseYes
action:
- service: light.turn_off
entity_id: light.basement_light