Google TTS - not getting the mp3 files

I’m new in Home Assistant and first time posting a topic here…

I am trying to get the TTS to work with my Google Mini. I call the Google Translate service but I just cannot get the mp3 files in the cache folder.

I am running HA in RPi 4
I have read several blog topics about TTS issues and tried several changes in my configuration, moved the cache folder, I have setup already DuckDNS tried with NGINX and Nginx Proxy Manager, which is the on I am currently using.
I have port fowarding in my router for ports 443 > 443 and 80 > 80.

My config file has the following lines:

homeassistant:
  external_url: https://[my domain].duckdns.org
  internal_url: http://homeassistant.local:8123
 
http:
  use_x_forwarded_for: true
  trusted_proxies: 127.0.0.1                 

tts:
  - platform: google_translate
    service_name: google_translate_say
    cache: true
    cache_dir: /config/tts
    base_url: http://192.168.1.246:8123  # my HA fix ip address
    time_memory: 300

google_assistant:
    project_id: homeassistant-40ce0
    service_account: !include HomeAssistant-0ed8af374720.json
    report_state: true

I have tried couple of ways to send the TTS request:

  • Directly typing in the Google Mini card in the Test to speak field
  • Call the service from the Developer Tools
    Call_TTS_Service
  • Using the following script:
test_tts:
  alias: test_TTS
  sequence:
  - service: tts.google_translate_say
    entity_id: media_player.estudio
    data:
      message: 'Hello October'
  mode: single

I verified that my Google Mini can play files from TTS cache directory with the script below and the mp3 file plays with no problem.

test_estudio:
  alias: test_estudio
  sequence:
  - service: media_player.play_media
    entity_id: media_player.estudio
    data:
      media_content_type: 'music'
      media_content_id: https://[my domain].duckdns.org/api/tts_proxy/2aae6c35c94fcfb415dbe95f408b9ce91ee846ed_en_-_google_translate.mp3
  mode: single

I will apprecite any suggestion as to why I am not able to get the mp3 files in cache folder after calling the TTS service?

If I remember correctly your tts url has to be the external url because I assume you use https.(edit I see now that you do.)
So when you use the internal ip the certificate does not match and it fails.
Try routing the tts to your duckdns

Thank you @Hellis81 for your suggestion.

I have tried that before, but I give it another try, since I have several days trying and at this point I am not quite sure what configuration I have already tried… so I set the tts configuration as follows:

tts:
  - platform: google_translate
    service_name: google_translate_say
    #language: 'es'
    cache: true
    cache_dir: /config/tts
    base_url: https://taj0mass1stant.duckdns.org  # changed to my external domain
    time_memory: 300

However it did not work, still not getting the mp3 file from tts service.

As I mentioned, I setup a reverse proxy using the Nginx Proxy Manager as per @SteveDinn suggestion, who explained that it would take care of managing SSL certificate for external traffic and it would keep internal network using normal http. Here is the post

Google TTS - wont talk

And this is how I setup the Nginx Proxy Manager

I am wondering how could I check the tts service call is actually sending something to google translate service and whether I have any response back. My concern is that I may not be handling either the request or reponse correctly.

What version of HA are you using?What errors are in the log?

In my case, I have the Google translate URL set to my internal IP address without HTTPS. My internal devices can’t access my external address.

I have the Home Assistant 0.115.6

This are the errors in the Log:

2020-10-05 22:08:37 ERROR (MainThread) [homeassistant.components.google_translate.tts] Timeout for google speech
2020-10-05 22:08:37 ERROR (MainThread) [homeassistant.components.tts] Error on init TTS: No TTS from google_translate for 'how are you'
2020-10-05 22:15:00 ERROR (MainThread) [homeassistant.components.google_translate.tts] Timeout for google speech
2020-10-05 22:15:00 ERROR (MainThread) [homeassistant.components.tts] Error on init TTS: No TTS from google_translate for 'Second try'

I see, there are errors while initializing TTS component.

BTW… I accessed the HA from a device I had not accessed before and the TTS worked, but just one time. Then, I try again right after and it stopped working. This is the state of the google mini after TTS worked:

volume_level: 0.4000000059604645 
is_volume_muted: false 
media_content_id: http://192.168.1.246:8123/api/tts_proxy/2aae6c35c94fcfb415dbe95f408b9ce91ee846ed_en_-_google_translate.mp3 
media_duration: 0.984
media_position: 0 
media_position_updated_at: 2020-10-05T20:51:42.983219+00:00 
app_id: CC1AD845 
app_name: Default Media Receiver 
entity_picture_local: null 
friendly_name: Estudio 
supported_features: 152463

By seeing the log errors and the state of the Google mini, it seems that as long as the TTS component is initialized correctly, the rest of the configuration seems to be ok.

Is there any way I could get further details on the TTS error?

Should I place the tts configuration section on a specific order in the configuration yaml file?

I will appreciate any ideas / suggestions.