Problems using TTS

Hey,

I am trying to get TTS to work. I know that I probably won’t get it to work because of the hardcoded DNS and because my router does not support NAT loopback (hence I can only use the duckdns addresse from outside my network), but checking my logs I was worried that I’m not even getting that far. I think the file should be created anyway, but it seems that no file is created. Here are my logs when trying to call the service:

2018-04-15 22:02:23 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall tts.google_say: entity_id=[‘media_player.cocktail’], message=Test>
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/urllib3/connection.py”, line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File “/usr/lib/python3.6/site-packages/urllib3/util/connection.py”, line 60, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File “/usr/lib/python3.6/socket.py”, line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 601, in urlopen
chunked=chunked)
File “/usr/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 346, in _make_request
self._validate_conn(conn)
File “/usr/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 850, in _validate_conn
conn.connect()
File “/usr/lib/python3.6/site-packages/urllib3/connection.py”, line 284, in connect
conn = self._new_conn()
File “/usr/lib/python3.6/site-packages/urllib3/connection.py”, line 150, in _new_conn
self, “Failed to establish a new connection: %s” % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x6fb21950>: Failed to establish a new connection: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/requests/adapters.py”, line 440, in send
timeout=timeout
File “/usr/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File “/usr/lib/python3.6/site-packages/urllib3/util/retry.py”, line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘translate.google.com’, port=443): Max retries exceeded with url: / (Caused by NewConnectionError(‘<urllib3.connection.VerifiedHTTPSConnection object at 0x6fb21950>: Failed to establish a new connection: [Errno -3] Try again’,))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/core.py”, line 1002, in _event_to_service_call
await service_handler.func(service_call)
File “/usr/lib/python3.6/site-packages/homeassistant/components/tts/init.py”, line 135, in async_say_handle
options=options
File “/usr/lib/python3.6/site-packages/homeassistant/components/tts/init.py”, line 305, in async_get_url
engine, key, message, use_cache, language, options)
File “/usr/lib/python3.6/site-packages/homeassistant/components/tts/init.py”, line 319, in async_get_tts_audio
message, language, options)
File “/usr/lib/python3.6/site-packages/homeassistant/components/tts/google.py”, line 85, in async_get_tts_audio
token.calculate_token, part)
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/lib/python3.6/site-packages/gtts_token/gtts_token.py”, line 28, in calculate_token
seed = self._get_token_key()
File “/usr/lib/python3.6/site-packages/gtts_token/gtts_token.py”, line 58, in _get_token_key
response = requests.get(“https://translate.google.com/”)
File “/usr/lib/python3.6/site-packages/requests/api.py”, line 72, in get
return request(‘get’, url, params=params, **kwargs)
File “/usr/lib/python3.6/site-packages/requests/api.py”, line 58, in request
return session.request(method=method, url=url, **kwargs)
File “/usr/lib/python3.6/site-packages/requests/sessions.py”, line 508, in request
resp = self.send(prep, **send_kwargs)
File “/usr/lib/python3.6/site-packages/requests/sessions.py”, line 618, in send
r = adapter.send(request, **kwargs)
File “/usr/lib/python3.6/site-packages/requests/adapters.py”, line 508, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘translate.google.com’, port=443): Max retries exceeded with url: / (Caused by NewConnectionError(‘<urllib3.connection.VerifiedHTTPSConnection object at 0x6fb21950>: Failed to establish a new connection: [Errno -3] Try again’,))

My config is:

http:
  base_url: xxxx.duckdns.org
  ssl_certificate: /ssl/fullchain.pem
  ssl_key: /ssl/privkey.pem
  api_password: !secret http_password

tts:
  - platform: google
    language: 'de'
    cache: true
    cache_dir: /tmp/tts
    time_memory: 300

Cheers,
ciB

I deactivated dnsmasq and now it “works”, although as suspected my google devices cannot play the local files since I don’t have NAT loopback. Has anybody got this ever to work?