Google Home TTS not working DuckDNS & Lets Encrypt

One thing I just had to do was ensure that I had public 8123 port forwarding to my hassio 8123 since it was in the base URL. Without that my google home was making a chime but not saying the message.

2 Likes

Trying to use Google TTS.

config.yaml:

http:
  base_url: example.duckdns.org

tts:
  - platform: google

I can use. Thanks for reply.

Hey Sunonline, did you have any success with this? I’ve tried everything I’ve read and know of and still no luck…

Yes. I can use tts google.

my config is as on post #3

tts:
  - platform: google
    cache: true
    language: 'en-uk'  <=== google support many languages, you can check the language you want and put here.
    cache_dir: /tmp/tts
    time_memory: 300

by putting like this I can text to speech from outside network to inside network

http:
  base_url: https://domainname.duckdns.org:8123  <=== google tts work with or without let's encrypt. but if you have let's encrypt your base url will be start with https and need ssl_cert, ssk_key clarify
  api_password: YOUR_PASSWORD
  ssl_certificate: /etc/letsencrypt/live/hass.example.com/fullchain.pem
  ssl_key: /etc/letsencrypt/live/hass.example.com/privkey.pem

thanks gureyes, I tried that but the docker container doesn’t seem to be working on Intel NUC. From what I’ve read, I think the error is related to incompatibility with architecture

standard_init_linux.go:195: exec user process caused "exec format error"

have same problem, anyone have solution for this.
Tried @Sunonline suggestion with no luck

what do you use for your media_player?

I use vlc as media_player. after install vlc. I also ssh to allow homeassistant(username_for_homeassistant) to be able to use audio “sudo usermod -a -G audio homeassistant
3.5 mm jack to rpi3.

setting this under media_player platform

  - platform: vlc
    name: HA Speaker
    arguments: '--alsa-audio-device=hw:0,0'  <=== use ssh type "aplay -L" to see the hw use and subdevice use

setting this under tts platform

  - platform: google
    language: 'en-uk'  <== you can use language you want. check from google
    cache: true
    cache_dir: /tmp/tts
    time_memory: 300

setting this under http platform

  base_url: https://domain.duckdns.org:8123 <== a must with homeassitant port
  api_password: homeassistant_password
  ssl_certificate: where_ever/your/sslcert/located/fullchain.pem
  ssl_key: where_ever/your/sslcert/located/privkey.pem

if you don’t use let’s encrypt

  base_url: http://domain.duckdns.org:8123 <== a must with homeassitant port
  api_password: homeassistant_password

Thank you @Sunonline
I use VLC as media_player. Tested it with other audio source and it worked.
Also added “sudo usermod -a -G audio homeassistant”
When I run systemctl status homeassistant. It said “serving …mp3 file to <my external ip> (Auth: false)” instead of my https://domain.duckdns.org
My current setup forwarded port 443 to 8123, also tried forward 8123 to 8123, nothing works

did you use ssl? if yes you have to provide with ssl_certificate and key.

Forward port at your router 443 to 8123 and 8123 to 8123 as well.

at http you don’t need server_port: because you already put port at the back of base_url

If possilble please show the config of http and tts google

regarding the ssh sudo usermod -a -G audio homeassistant <== the homeassistant is the username you run homeassistant. some people use pi or other name so put the right username for homeassistant as tts run from user that run homeassistant.

for tts google setting.

  - platform: google
    language: 'en-uk'  <== you can use language you want. check from google
    cache: true
    cache_dir: /tmp/tts  <== you have to create folder name tts inside homeassistant config folder. It won't create by themself.
    time_memory: 300
 http:
  # Secrets are defined in the file secrets.yaml
  api_password: !secret http_password
  # Uncomment this if you are using SSL/TLS, running in Docker container, etc.
  base_url: https://xxxhome.duckdns.org:8123
  ssl_certificate: /etc/letsencrypt/live/xxxhome.duckdns.org/fullchain.pem
  ssl_key: /etc/letsencrypt/live/xxxhome.duckdns.org/privkey.pem
# Text to speech
tts:
  - platform: google
    cache: true
    cache_dir: /tmp/tts
    time_memory: 300

Here it is. homeassistant is username used to run HA

Can you try put the language inside your tts google and also create a folder name tts in homeassitant config folder.

list of support language
‘af’, ‘sq’, ‘ar’, ‘hy’, ‘bn’, ‘ca’, ‘zh’, ‘zh-cn’, ‘zh-tw’, ‘zh-yue’,
‘hr’, ‘cs’, ‘da’, ‘nl’, ‘en’, ‘en-au’, ‘en-uk’, ‘en-us’, ‘eo’, ‘fi’,
‘fr’, ‘de’, ‘el’, ‘hi’, ‘hu’, ‘is’, ‘id’, ‘it’, ‘ja’, ‘ko’, ‘la’, ‘lv’,
‘mk’, ‘no’, ‘pl’, ‘pt’, ‘pt-br’, ‘ro’, ‘ru’, ‘sr’, ‘sk’, ‘es’, ‘es-es’,
‘es-us’, ‘sw’, ‘sv’, ‘ta’, ‘th’, ‘tr’, ‘vi’, ‘cy’, ‘uk’,

Don’t forget to check config and restart homeassistant

tts folder already existed. I can found mp3 there and play it. But not in VLC

when you test vlc to run mp3. what user are you using?
You mention from above post Tested it with other audio source and it worked. <== you mean also cannot run mp3?

It worked now! Thank you a lot @Sunonline. The problem is, I changed my default output device to hw:1,0 for user pi, not for homeassistant

Glad you got it working and have fun.

@Sunonline,

I’m so glad you posted about forwarding 8123 to 8123 on the HA as well as 443.
I’ve been wrestling with this for a couple of days! Sheesh!

Many thanks!

Your welcome.

I have noticed that the actual text I typed into ‘Text to Speak’ is saved as .mp3 in the tts folder so not sure why Google Home cannot just say it ??

I guess your problem might be that your Google Home Media Player is trying to reach those mp3-files in your Hassio’s /tts -folder with the base_url DNS-name and probably Google Home Media Player is hardcoded to use primarily Google DNS servers (as ChromeCast is).

Google DNS-servers (e.g 8.8.8.8) naturally returns the public IP (usually from Dynamic DNS service) and not the private IP that the media player device should connect to in your internal network.

My workaround was to have an internal DNS-server where I redirect DNS-traffic (UDP 53) going to 8.8.8.8. The internal DNS server then resolves the DNS name to the private IP address of the Hassio.

I’m not sure but instead of redirect you might also be able to block Google DNS (atleast 8.8.8.8, probably more) and then the device would use the DNS-server it got from DHCP.

Hope this helps someone, surely did the trick for me.

2 Likes