Text-to-Speech problem with Chromecast Audio

I like that! Thanks.

Also did you mean mA4 format?

I don’t seem to be able to export mp4 from audacity.

leave the file in mp3 format, but in your HA command use mp4:

  - service: media_player.play_media
    data:
      entity_id: media_player.entrance
      media_content_id: https://mydomain.duckdns.org/local/sounds/Doorbell2.mp3
      media_content_type: 'audio/mp4'
1 Like

Just as an update, I’ve given up on this.

No matter what I do the chromecast audio always misses the beginning portion of the sound, using TTS or playing a file, if called from an automation or script, even when the media player is on and idle.

I’ve tired all the suggestions listed in the thread above, I’ve improved my wifi (using unifi APs now) I’ve tried caching the audio, not caching, adding up to 5 seconds of silence to the beginning of media files (not a viable solution for a doorbell anyway), and loads more.

Fortunately I have an iPad that I can play sounds attached to messages without problem so I’m going with that for now.

Weird, I have 5 CC Audio, and 2 GH Mini’s around the house, and can play TTS through them fine without missing anything.

Don’t know if it has something to do with you using a DuckDNS address, all mine is handled locally.

I was under the impression that the url had to be accessible from the internet for the media to play?

I remember it took me a while to find the right setup.

I don’t use any port forwarding, or any dynamic DNS on my setup. I access my HA though VPN when I am away from the house.

This is my TTS config,

tts:
  - platform: google
    cache: true
    cache_dir: /config/tts
    time_memory: 300
    language: 'en-uk'

I also have a base url set as my internal ip address as I am running in a docker container,

http:
  api_password: !secret http_password
  base_url: http://10.0.0.2:8123

And that setup seem’s to work fine for me.

This is great. Thanks so much! Was having issues where it would give the notification noise on the Minis but then maybe 1 of them would actually play the notification that I had setup. Now it should play them everywhere and always when they trigger! :+1:

Finally worked out what was wrong with my set up. The powered speaker I plugged my chromecast audio into takes forever to recognise something is playing and unmute.

Nothing wrong with TTS or media player. It was the speaker!

1 Like

This worked wonderfully, but I had to use
platform: time_pattern
instead of:
platform: time

Thanks!

1 Like

Yes my post was 2 years ago. There was a breaking change in between. It’s one of the things one needs to keep an eye on when copying old solutions.
Thanks for commenting so others are aware :wink:

One thing I had a question about, though. In your automation in post #3, you check to make sure the following devices are not playing;

living room mini
kitchen mini
group mini (i assume this group includes the two above)

Is checking to make sure the entire group is not playing necessary, since you’re checking to catching each one individually above it? Or is this specifically to catch when something else is being casted to the entire group?

Checking the group is probably overkill. Indeed the group covers each of the Google minis. At the time I wasn’t sure if each mini would show a playing status when I played on the group. The check is obviously to ensure I don’t play the silent file of I’m playing music a tts announcement…

alias: Keep Google Home Minis Alive
description: ''
trigger:
  - platform: time_pattern
    minutes: /2
condition:
  - condition: template
    value_template: '{{ states.media_player.home_assistant_speaker.state != "playing"}}'
  - condition: template
    value_template: '{{ states.media_player.home_assistant_speaker_2.state != "playing"}}'
  - condition: template
    value_template: '{{ states.media_player.home_assistant_speakers.state != "playing"}}'
action:
  - service: media_player.play_media
    entity_id: media_player.home_assistant_speakers
    data:
      media_content_id: 'http://192.168.1.30:8123/local/audio/silence.mp3'
      media_content_type: music
mode: single

Does this look OK? I sometimes still get the wake-up chime during my TTS events on at least one of my speakers and I’m unsure why. I’ve confirmed in the Home app on my phone that these two speakers are in group “Home Assistant Speakers”. The http://192.168.1.30:8123/local/audio/silence.mp3 file is accessible and one second long - when I open the Home app it does say “Now Playing” when I go to each individual speaker’s details.