Google Home Text to Speech

My house is full of Alexa devices, but I have ended up with two free Google Home devices recently, so I set them up for comparison. I am happy with how it controls devices, but I want to try Text to Speech now.

I setup the “Google Cloud Platform”, and now I have tts.cloud_say available. I get an attention chime from the speaker, but the following service example does not play the audio.

service: tts.cloud_say
data:
  entity_id: media_player.google_family_room
  message: 'Hello world'

However, looking at the state of media_player.google_family_room I see media_content_id: http://homeassistant.local:8123/api/tts_proxy/7b502c3a1f48c8609ae212cdfb639dee39673f5e_en-us_a9c18110b0_cloud.mp3. Opening that URL says “Hello world” on my browser. So the TTS is being generated.

2020-10-08 20:23:31 INFO (SyncWorker_21) [pychromecast.controllers] Receiver:Launching app CC1AD845
2020-10-08 20:23:32 ERROR (Thread-10) [homeassistant.components.cast.media_player] Failed to cast media http://homeassistant.local:8123/api/tts_proxy/1519ae4eedc50d1cda10b6cd0e79433870382cbe_en-us_a9c18110b0_cloud.mp3 from internal_url (http://homeassistant.local:8123). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

I tried setting the base_url to http://10.0.0.5:8123 instead and it still failed. My next random thing to try will be pointing base_url to my nabu.casa URL… but every time I reboot Home Assistant tonight it sends an Apple 2 Factor Authentication request to my wife’s phone. She has to wake up early for work, so I definitely can’t do any more restarting tonight.

tts:
  platform: google_cloud
  key_file: google_tts.json
  base_url: http://10.0.0.5:8123

The solution was to set the base_url to an externally accessible URL (my nabu.casa address). Apparently Google Home devices cannot pull media from local IP addresses.

3 Likes

I’ve been using tts.cloud_say fine without setting the base url until I changed the port of my HASS instance from 8123. So I don’t think that’s true about google home devices not being able to pull media from a local IP address. I also send local files to it via media_player.play_media just fine.

Something is going on with the port being cached somewhere as I get this error now:
Failed to cast media http://192.168.0.5:8123/api/tts_proxy/aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d_en-us_a9c18110b0_cloud.mp3 from internal_url (http://192.168.0.5:8123). Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

I’ve changed the port in server_port: to 8089 and everything else works OK afaik.