Google TTS Problems

I can confirm that the fix from here works. The process I followed on Hassbian to fix this was;

cd /srv/homeassistant
sudo python3 -m venv .
source bin/activate
sudo nano /srv/homeassistant/lib/python3.5/site-packages/gtts_token/gtts_token.py

Delete and add in the new text as shown in the link provided, reboot you Pi, fixed.

Awesome, thanks so much for that info. TTS back up and working like a gem!!

Time for a beer I think!

1 Like

Thanks Guys
That works great :+1::beer::beer:

I used the add to custom_components way. @TheFuzz4.:grin:

What issues are you seeing with deconz?

I’ve verified that with 78.3 that my TTS is back to working as it should. Don’t forget that once you upgrade to remove those tts folders that were unpacked from that zip if you used that method.

1 Like

I cant get it to work?..
Have replace the lines…
And I also see that it creates a new mp3 file in tts folder, but it wont play it on the speakers

Starting today Nov 29:th I get the exact same problem as OP. I’m using latest Hass.io v140 with HASS 0.82.1 and this has been working flawlessly for weeks until today. Has token expired again? Is anyone else experiencing this?

got the same today as well…ugh!!
I’m on Hassbian though

Here’s the traceback:

    2018-11-29 17:00:11 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall tts.google_say (c:6ec27b9f9a3448e38d4e355e5c25ddf6): entity_id=['media_player.srsx77_mist_2'], message=Klockan är 17:00 och det är 1 grader ute., cache=False>
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1177, in _event_to_service_call
    await service_handler.func(service_call)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/tts/__init__.py", line 137, in async_say_handle
    options=options
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/tts/__init__.py", line 306, in async_get_url
    engine, key, message, use_cache, language, options)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/tts/__init__.py", line 318, in async_get_tts_audio
    message, language, options)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/tts/google.py", line 83, in async_get_tts_audio
    token.calculate_token, part)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/gtts_token/gtts_token.py", line 28, in calculate_token
    seed = self._get_token_key()
  File "/usr/local/lib/python3.6/site-packages/gtts_token/gtts_token.py", line 57, in _get_token_key
    tkk_expr = re.search(".*?(TKK=.*?;)W.*?", line).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

Looks like Google Translate changed some stuff. Fix of gtts-token seems to be worked on: https://github.com/Boudewijn26/gTTS-token/pulls

1 Like

Thanx bro… it now works… applied th changes as per your link

This error seems to affect quite a lot of people, looking forward to early patches, thanks to the programmer

vicom, did you change gtts_token.py only or something else? I’ve replaced gtts_token.py and I’m still getting this error.

Error executing service <ServiceCall tts.google_say (c:9fef305e47ed41a89faedac64d82c937): message=5 minutes, entity_id=['media_player.kitchen']>
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1177, in _event_to_service_call
    await service_handler.func(service_call)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/tts/__init__.py", line 137, in async_say_handle
    options=options
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/tts/__init__.py", line 306, in async_get_url
    engine, key, message, use_cache, language, options)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/tts/__init__.py", line 318, in async_get_tts_audio
    message, language, options)
  File "/config/custom_components/tts/google.py", line 83, in async_get_tts_audio
    token.calculate_token, part)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/gtts_token/gtts_token.py", line 29, in calculate_token
    seed = self._get_token_key()
  File "/config/custom_components/gtts_token/gtts_token.py", line 58, in _get_token_key
    tkk_expr = re.search(".*?(TKK=.*?;)W.*?", line).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

only removed two lines and replaced with one line…
but i see they already did a pull request and patched the entire gtt_token.py file

follow this link

remove the lines marked in red (-)
and add the lines marked on green (+)

3 Likes

interesting… I did as you suggested - still no go. This is on a fresh (1 day old) hass.io vmdk appliance v140 0.83.

I have an older Ubuntu vm with HA 82.1 - Google TTS works on it without any issues so far.

I need coffee… vicom, your link/instructions worked!!! thank you!!!

lol… happens to all of us… I’m busy upgrading to HA 0.83 will see if it still works

i did the patch on 0.83… working so far

I’m on 0.82.1, updated to gTTS-token-1.1.3 and TTS still not working. I’ve never ever had Google TTS work in Home Assistant, even when I was at version 0.5*.*. I’m tried to play TTS to Chromecast and a Google Home Mini, it’s just silent.

Edit, I decided to troubleshoot this and fixed this. I took the following steps:
1: Update gTTS-token (resolved the “AttributeError: ‘NoneType’ object has no attribute ‘group’” error)
2: Change base_url to remove trailing slash and port number (example: https://domain.com")
3: In case of my specific environment, I’m using split-brain DNS for https://domain.com so that the IP inside is a local reverse proxy and the external IP is on another reverse proxy). In my case, I am unable to access port 443 of my public IP which is what Google Home was trying to do. Why doesn’t it use internal DNS? Well its a known issue for Chromecasts so I decided to block Google Home from Google DNS and voila. After restarting it works. Alternatively if not using HTTPS internally, you can set base_url to an IP address to avoid DNS resolution.