Problems with google home tts

Hi, I’m trying to make my google home mini (media_player.salotto in the code below) says a message when an event occurs but all I get is the media player going idle and a “ping” sound… this is my config file:

# Text to speech
tts:
  - platform: google
    cache: true
    cache_dir: /tmp/tts
    time_memory: 300
    base_url: http://192.168.1.113:8123

this the tts section of the automation file:

- service: media_player.turn_on
  data:
    entity_id: media_player.salotto  
- service: media_player.volume_set
  data_template:
    entity_id: media_player.salotto
    volume_level: 0.3
- service: tts.google_say
  entity_id: media_player.salotto
  data_template:
    message: "ALLARME ALLARME ALLARME"
    language: "it"
    cache: false

and this the errors I got:

2018-11-02 11:35:12 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall tts.google_say: entity_id=['media_player.salotto'], cache=False, language=it, message=ALLARME ALLARME ALLARME>
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1038, in _event_to_service_call
    await service_handler.func(service_call)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/tts/__init__.py", line 134, in async_say_handle
    options=options
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/tts/__init__.py", line 300, in async_get_url
    engine, key, message, use_cache, language, options)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/tts/__init__.py", line 313, in async_get_tts_audio
    message, language, options)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/tts/google.py", line 83, in async_get_tts_audio
    token.calculate_token, part)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/gtts_token/gtts_token.py", line 28, in calculate_token
    seed = self._get_token_key()
  File "/srv/homeassistant/lib/python3.5/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'

@AndreaF, I can tell you that on my setup, which is working, I have almost everything the same as yours except I had to take the base_url out of the configuration.yaml in the tts: section and the html: section for mine to work, and in the script definition, I didn’t use a data_template…try this script, it works for me…

tts_tester:
  alias: TTS Tester
  sequence:
  - data:
      entity_id: media_player.salotto
      volume_level: 0.30    
    service: media_player.volume_set
  - data:
      entity_id: media_player.salotto
      message: ALLARME ALLARME ALLARME
      language: it
    service: tts.google_say

Hope this helps.

thanks, I’ll try :+1::+1: