Google home TTS stopped working

Hello Everyone,
I have been running TTS on my google home for door status notifications. It has been working well. However, few hours ago just TTS stopped responding! I did not make any changes to HA or any components recently except I updated the HA to 78.0 last night. Please see the error msg below from HA logs and my config.

Any thoughts? Please help me out!

Error executing service <ServiceCall tts.google_say (c:c8624389c43942a29c59a80941921a22): entity_id=[‘media_player.living_room_speaker’], message=hi>
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/core.py”, line 1127, 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 62, in _get_token_key
a = re.search(“a\\x3d(-?\d+);”, tkk_expr).group(1)
AttributeError: ‘NoneType’ object has no attribute ‘group’

Config:

tts:

  • platform: google
    cache: true
    cache_dir: /tmp/tts
    time_memory: 300

I’m seeing the exact same issue. Added a new tts google_say phrase to node-red this morning and it would not be spoken. I made the mistake of cleaning out the cache and every phrase is coming back with the Error executing service <ServiceCall tts.google_say and AttributeError: ‘NoneType’ object has no attribute ‘group’

I’m on 0.76.2. No recent upgrades taken. Restarted HASS several times, rebooted pi3 it’s hosted on once.

I have the same problem since yesterday with my GassistPi Google Home running on my Raspberry Pi, Google TTS will not respond to anything even when ran manually. Here is the error message from my Pi.

ON_CONVERSATION_TURN_STARTED
ON_CONVERSATION_TURN_STARTED
ON_END_OF_UTTERANCE
ON_END_OF_UTTERANCE
ON_RECOGNIZING_SPEECH_FINISHED:
{“text”: “turn the lights on”}
ON_RECOGNIZING_SPEECH_FINISHED:
{“text”: “turn the lights on”}
Traceback (most recent call last):
File “/home/pi/GassistPi/src/main.py”, line 194, in
main()
File “/home/pi/GassistPi/src/main.py”, line 177, in main
Action(str(usrcmd).lower())
File “/home/pi/GassistPi/src/actions.py”, line 846, in Action
say(‘Turned on all the lights.’)
File “/home/pi/GassistPi/src/actions.py”, line 91, in say
words= translator.translate(words, dest=language)
File “/home/pi/env/lib/python3.5/site-packages/googletrans/client.py”, line 172, in translate
data = self._translate(text, dest, src)
File “/home/pi/env/lib/python3.5/site-packages/googletrans/client.py”, line 75, in _translate
token = self.token_acquirer.do(text)
File “/home/pi/env/lib/python3.5/site-packages/googletrans/gtoken.py”, line 180, in do
self._update()
File “/home/pi/env/lib/python3.5/site-packages/googletrans/gtoken.py”, line 59, in _update
code = unicode(self.RE_TKK.search(r.text).group(1)).replace('var ', ‘’)
AttributeError: ‘NoneType’ object has no attribute ‘group’

1 Like

I fixed it by switching to pico2wave temporarily by adding this code and commented out the gTTS code. It doesn’t sound as good as Google Text to Speech though.

##Speech and translator declarations
#ttsfilename="/tmp/say.mp3"
#translator = Translator()
#language=‘en’

#Text to speech converter with translation
#def say(words):
#words= translator.translate(words, dest=language)
#words=words.text
#words=words.replace("Text, ",’’,1)
#words=words.strip()
#print(words)
#tts = gTTS(text=words, lang=language)
#tts.save(ttsfilename)
#os.system("mpg123 "+ttsfilename)
#os.remove(ttsfilename)

#Text to speech converter
def say(words):
tempfile = “temp.wav”
devnull = open("/dev/null",“w”)
lang = “en-US” #Other languages: en-US: US English, en-GB: UK English
subprocess.call([“pico2wave”, “-w”, tempfile, “-l”, lang, words],stderr=devnull)
subprocess.call([“aplay”, tempfile],stderr=devnull)
os.remove(tempfile)

1 Like

There is a thread of others experiencing this problem over on the gTTs git - https://github.com/pndurette/gTTS/issues/60. Sounds like this could just be a google problem from previous messages in the thread but I don’t know.

I may have stumbled upon the issue and fix - https://github.com/home-assistant/home-assistant/issues/16749. I am still testing and will report in that thread.

Hi Edif30,
Thank you for creating an issue. I see from the other thread that it is fixed. I run hassioand so may I know how to update gTTS-token or what I need to do to get it work?

@Eagu I’d ask some hass.io users. But technically you should be able to exec into the docker container and update the file with the patch of code.

I have exactly the same issue, feels like something happened to tts and google home after upgrade to 0.78. In 0.78.1 it stopped working completely.
However it works from the Google Home card.

I am still on 76.2 and TTS has also just stopped working for me

Mine worked yesterday (20 Sept) at 8:15 UK time (13 hours ago from posting this) but didn’t work at 8:15 this morning (1 hour ago).

I am on 0.76.1 (hassio) so don’t think it is related to the HA version.

Same here HA 78.1

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.

I manage to fix it using @TheFuzz4

Google TTS Problems

Sorry @kanga_who I would of done your fix but I don’t have HA running on a PI.

1 Like

Had the exact same issue and solved by following benproiii’s fix by editing it in actions.py.

Can confirm that 0.78.3 update fixes tts

1 Like

Well, I’m still facing issues after updating to 78.3. However, this time the errors are different. Please see the errors I get every time when I call TTS. On this regard, I did some search and it looks like several folks have been facing this issue. I tried few of the resolutions suggested such as remove https:// , port number and both at base_url. However, none saved me!

Platform cast not ready yet. Retrying in 120 seconds.

> Error doing job: SSL handshake failed
> Traceback (most recent call last):
>   File "uvloop/handles/stream.pyx", line 609, in uvloop.loop.UVStream._on_eof
>   File "uvloop/sslproto.pyx", line 171, in uvloop.loop._SSLPipe.feed_ssldata
>   File "/usr/local/lib/python3.6/ssl.py", line 689, in do_handshake
>     self._sslobj.do_handshake()
> ssl.SSLError: [SSL: HTTP_REQUEST] http request (_ssl.c:841)

> Error doing job: SSL error errno:1 reason: HTTP_REQUEST
> Traceback (most recent call last):
>   File "uvloop/sslproto.pyx", line 504, in uvloop.loop.SSLProtocol.data_received
>   File "uvloop/sslproto.pyx", line 204, in uvloop.loop._SSLPipe.feed_ssldata
>   File "uvloop/sslproto.pyx", line 171, in uvloop.loop._SSLPipe.feed_ssldata
>   File "/usr/local/lib/python3.6/ssl.py", line 689, in do_handshake
>     self._sslobj.do_handshake()
> ssl.SSLError: [SSL: HTTP_REQUEST] http request (_ssl.c:841)

I would suggest removing the component, rebooting and re-configuring.

Thank you for the reply Kanga_who! It was my mistake. When we had this TTS issue, I was editing the configuration for TTS and forgot to remove the base_url under TTS. After I removed the base_url, it worked like a charm! Thank you once again!

1 Like

Looks like something has changed on TTS from Google end. I’m unable to get TTS working. I do not recall on anything that had changed recently! Does anyone have this issue with the errors like below?

Thank you

2018-11-28 20:37:26 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall tts.google_say (c:eada5bf6158447c2972acd063767fb8c): entity_id=['media_player.officeroom_speaker'], message=hello>

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)