Google nest speaker beeps but does not talk

I have this script

alias: Announce
description: Play message on speakers
trace:
  stored_traces: 100
fields:
  message:
    name: Message
    description: The message to play
    selector:
      text: null
  speakers:
    name: Speakers
    description: Speakers to broadcast on
    selector:
      entity:
        multiple: true
        integration: cast
        domain: media_player
sequence:
  - action: media_player.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: "{{ speakers }}"
  - target:
      entity_id: tts.google_translate_en_com_au
    data:
      media_player_entity_id: "{{ speakers }}"
      message: "{{ 'Alert, ' ~ message }}"
      cache: false
    action: tts.speak
  - action: media_player.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: "{{ speakers }}"
    enabled: true
mode: queued
icon: mdi:bullhorn-variant
max: 10

Lately it’s failing. I hear the speaker beep. Nothing.

Press it again, it talks.
Again, beep only.

Any ideas?

Remove the turn off action.
It will turn off by itself or at least delay it with a 10-15 seconds.

Thanks initially it was not working (sometimes) and I didn’t have turn on or off. So I added on and off. But I’ll try without the off and see how it goes the next few days.

That is the issue. The commands are sent one by one, when the message is sent, the next one is sent which turns it off.
So that’s why you hear the beep and then nothing, because you turn it off immediately.

can I ensure the speaker is on before it talks? Maybe the translator is finished before the speaker is fully on

I never send turn on or off commands to my speakers.
And they work fine.

1 Like

It’s still doing it, it will say two or three words and then cut off.
Is it because I’m using a helper script

Have you tried modes other than queued like mode: restart ?

Any info in Traces when the script is executed?

Post the complete automation/script that runs when it speaks.

1 Like

Here is the Trace. In this instance it just said alert and then cut off

The script is the same as the very top except I took out the speaker off line.

I’m going to try adding a delay to see if that helps the speaker turn on or something

alias: Announce
description: Play message on speakers
trace:
  stored_traces: 100
fields:
  message:
    name: Message
    description: The message to play
    selector:
      text: null
  speakers:
    name: Speakers
    description: Speakers to broadcast on
    selector:
      entity:
        multiple: true
        integration: cast
        domain: media_player
sequence:
  - action: media_player.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: "{{ speakers }}"
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
    enabled: true
  - target:
      entity_id: tts.google_translate_en_com_au
    data:
      media_player_entity_id: "{{ speakers }}"
      message: "{{ message }}"
      cache: false
    action: tts.speak
mode: queued
icon: mdi:bullhorn-variant
max: 10

This may be worth testing…

Partial, corrupted or no audio

Some media players could reproduce only partial, corrupted or no audio at all when the audio format is not fully supported. In such cases it is required to experiment with different combinations of audio formats, channels, sample rates and bits using preferred audio settings options.

For example, some Google Cast devices skip initial audio part when the audio is sampled at 22050Hz, and to fix the problem it is required to set the preferred_sample_rate setting in the options option to 44100.

action: tts.speak
target:
  entity_id: tts.example
data:
  media_player_entity_id: media_player.kitchen
  message: "May the force be with you."
  options:
    preferred_format: mp3
    preferred_sample_rate: 22050