Tts.google_say errors 'NoneType' object has no attribute 'group'

Hi guys, I recently started working with HA (running on RPi 3B+ with raspbian stretch in docker). All worked fine but google tts seems to be broken now.

The error that I get:

Log Details (ERROR)
Fri Sep 21 2018 11:09:16 GMT+0200 (Central European Summer Time)

Error executing service <ServiceCall tts.google_say (c:71c8aa7cb1f24ca5a685bf932de0fe81): entity_id=[''], message=test>
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/", line 1127, in _event_to_service_call
    await service_handler.func(service_call)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/tts/", line 137, in async_say_handle
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/tts/", line 306, in async_get_url
    engine, key, message, use_cache, language, options)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/tts/", line 318, in async_get_tts_audio
    message, language, options)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/tts/", line 83, in async_get_tts_audio
    token.calculate_token, part)
  File "/usr/local/lib/python3.6/concurrent/futures/", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/gtts_token/", line 28, in calculate_token
    seed = self._get_token_key()
  File "/usr/local/lib/python3.6/site-packages/gtts_token/", line 62, in _get_token_key
    a ="a\\\\x3d(-?\d+);", tkk_expr).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

After searching the web I found a possible solution:
which pointed to this:

Any thoughts on how to do this when using HA in a docker container?

Known issue, possible solution gTTS-token update.

thanks! didn’t find it somehow.

For people who find this topic first. This worked for me:
I went into the console of my HA docker container (I use portainer) and executed:

pip uninstall gTTS-token
pip install gTTS-token

Then restarted HA and tss is working again

This is broken again now, but I have a fix in pull request. A working version of the gtts_token can be found here:




I have been in the process of moving my setup from a Pi at 0.75.1 to a Docker setup on 0.82.1, and I thought I had something messed up in the config for the last hour. Should have searched here first.

Thank you for the update, just used the old custom_component from here, Google TTS Problems and updated the with your new code for now, and all back working again.