I created a script and want Home Assistant to speak two texts consecutively.
But only the last sentence works.
Is there a way I can let Google Cast to speak the first sentence, and then the second sentence?
say_english_and_chinese:
alias: Cast to two sentences in two languages
mode: queued
max: 20
sequence:
- service: tts.google_translate_say
data:
entity_id: media_player.gu_ge_mini
message: This is a test!
- service: tts.google_translate_say
data:
entity_id: media_player.gu_ge_mini
message: 这是一个测试!
language: zh
Put a delay between the two messages long enough to finish the first message.
I’m not good with yaml automations, I can only do the basic stuff. But I believe there is a wait until you could use also.
So wait until state is idle, then play second message.
say_english_and_chinese:
alias: Cast to prompt class starts in two languages
mode: queued
max: 20
sequence:
- service: tts.google_translate_say
data:
entity_id: media_player.gu_ge_mini
message: This is a test!
- delay: 3
- service: tts.google_translate_say
data:
entity_id: media_player.gu_ge_mini
message: 这是一个测试!
language: zh
But having fixed delays means that in some cases you might have to wait for two seconds, and sometimes the next message will interrupt the first message.