Hello,
I have try to make a script to send a text to speeach message to my alexa.
This is my configuration
But if I run the script I got this error:
Maybe anyone have an idea
Hello,
I have try to make a script to send a text to speeach message to my alexa.
This is my configuration
But if I run the script I got this error:
Maybe anyone have an idea
service: notify.alexa_media
data:
message: 'your message goes here'
target: media_player.echo_dot
data:
type: announce
Do not forget to replace echo_dot
with your own device name.
Ok perfekt this works for the first test.
Now I try to put an variable to the script:
service: notify.alexa_media
data:
message: '{{ message }}'
target: media_player.alexa_wohnzimmer1_2
data:
type: announce
And then I make an automation:
alias: Alexa Test
description: ''
mode: single
trigger:
- platform: state
entity_id: light.shapes_d392
from: 'off'
to: 'on'
condition: []
action:
- service: script.alexa_sprachausgabe_wohnzimmer_og
message: Das ist ein Test
But with this I got the following error if I save the automation:
Message malformed: extra keys not allowed @ datal’action’][0]l’message’
You can also call service notify.alexa_media.echo_dot
, calling the specific device, then skip specifying the target. For type, if you use announce
, then the alexa will play a notification sound before saying the message. If you want to just say the message without the notification sound, then use type: tts
.
Thank you it works.
This the code:
Script:
service: notify.alexa_media_alexa_wohnzimmer1_2
data:
message: '{{ message }}'
data:
type: announce
Automotion:
service: script.alexa_sprachausgabe_wohnzimmer_og
data:
message: OG Wohnzimmer Nanoleaf Tür wurde eingeschaltet
data:
type: announce
But I have one more question. Is it possible to put more than one notify in a script? If yes how?
in automation, you don’t need second data
which includes type: announce
, it is already part of script
Thanks for the correction.
But can I put two service: notify in one script?
I would put for example
notify.alexa_media_alexa_wohnzimmer1_2 and notify.alexa_media_alexa_buero
You can put multiple service calls in script, it is similar to actions of an automation, you are the limit
Have you an example for a multiple service call in a script?
I got it with the following code:
alias: Alexa Sprachausgabe EG komlett
sequence:
- service: notify.alexa_media_echo_dot
data:
message: '{{ message }}'
data:
type: announce
- service: notify.alexa_media_2_echo_dot
data:
message: '{{ message }}'
data:
type: announce
mode: single
Perfect, as a side note, you can create a notification group and add related speakers under it and just use group entity to send messages. For two, it may not be very important.
Ok thanks. But now I have put all the speakers separately in the script
Please mark the solution so other users can get benefit of it
Sorry I don’t find the button to do that