Chime TTS - Play audio before/after TTS audio lag free

Chime TTS

Link to GitHub

Chime TTS is a custom integration for Home Assistant that combines audio files with Text-to-Speech (TTS) audio locally, creating seamless playback without any lag or timing issues caused by cloud TTS processing and networking delays - perfect for playing a notification sound with a TTS notification.

Installation

Chime TTS can be installed manually or through HACS.

Refer to the GitHub wiki for further instructions.

Features

Chime TTS offers the following enhancements for TTS audio playback:
  • No lag or timing issues: Cloud TTS processing and network delays are eliminated, ensuring precise timing between audio files.

  • Customizable audio cues: Play preset audio options or your own custom files before and/or after the TTS message, creating a single file with seamless playback.

  • Flexible TTS platform selection: Chime TTS supports TTS platform integrations in Home Assistant.

  • Easy service invocation: The Chime TTS ‘say’ service can be used in automations, scripts, and other Home Assistant components, and supports queuing multiple service calls.

  • Set media player notification volume: Set the volume of the media player for the notification, and restore it back once playback ends.

  • Configurable TTS playback speed: Set the desired playback speed of the TTS audio, anywhere from 100% - 200%.

  • Configurable delay: Set a custom delay period between audio files and TTS audio.

  • Caching: Audio created by Chime TTS can be cached for faster playback in future service calls.

  • Speaker Groups: Supported speakers can be grouped together for simultaneous playback.

Services

chime_tts.say

The chime_tts.say service can play to multiple media_player targets and supports the following parameters:

Name YAML Key Required? Description Default
Chime Path chime_path Either an audio preset or a local audio file path to be played before the TTS message. None
End Chime Path end_chime_path Either an audio preset or a local audio file path to be played after the TTS message. None
Delay delay Delay (ms) between chime audio and the TTS message. 450ms
Final Delay final_delay Final delay (ms) added after playback (useful for queued calls). 0ms
Message message Required The text to be converted into TTS audio. None
TTS Platform tts_platform Required TTS platform to be used to create TTS audio. Note: the TTS platforms must be installed separately. None
TTS Playback Speed tts_playback_speed The desired playback speed for the TTS audio, anywhere from 100% - 200%. 100
Volume Level volume_level The volume level (between 0.0 - 1.0) to play the audio. The original value will be restored after playback. 1.0
Join Players join_players Play the audio simultaneously on media_players (that support speaker groups). False
Cache cache Save generated audio to the cache for reuse in future service calls. False
Announce announce Stops current media during the announcement and then resume (on supported devices). False
Options options YAML options field used by TTS services. None

Additional parameters (not supported by all TTS platforms)

Name Parameter Required? Description Supported TTS Platforms Default
Language language The speech language to use Google Translate, Nabu Casa Cloud TTS None
TLD tld The dialect domain Google Translate None
Gender gender Use a male or female voice Nabu Casa Cloud TTS None

Example

service: chime_tts.say
data:
  chime_path: custom_components/chime_tts/mp3s/tada.mp3
  message: The washing's done!
  tts_platform: google_translate
  tts_playback_speed: 120
  volume_level: 0.7
  cache: true
  announce: true
  language: en
  tld: com.au
target:
  entity_id:
    - media_player.homepod_mini
    - media_player.kitchen

chime_tts.say_url

The chime_tts.say_url service returns a publicly accessible URL to the MP3 file generated by chime_tts.say. Use cases may include playing the audio on media_players from Alexa, for example, which require a publicly available MP3 URL.

The service accepts the same parameters as chime_tts.say, except the media_player target and other media_player-related attributes.

Name YAML Key Required? Description Default
Chime Path chime_path Either an audio preset or a local audio file path to be played before the TTS message. None
End Chime Path end_chime_path Either an audio preset or a local audio file path to be played after the TTS message. None
Delay delay Delay (ms) between chime audio and the TTS message. 450ms
Final Delay final_delay Final delay (ms) added after playback (useful for queued calls). 0ms
Message message Required The text to be converted into TTS audio. None
TTS Platform tts_platform Required TTS platform to be used to create TTS audio. Note: the TTS platforms must be installed separately. None
TTS Playback Speed tts_playback_speed The desired playback speed for the TTS audio, anywhere from 100% - 200%. 100
Options options YAML options field used by TTS services. None

Additional parameters (not supported by all TTS platforms)

Name Parameter Required? Description Supported TTS Platforms Default
Language language The speech language to use Google Translate, Nabu Casa Cloud TTS None
TLD tld The dialect domain Google Translate None
Gender gender Use a male or female voice Nabu Casa Cloud TTS None

Example

The following YAML generates an MP3 file and then plays it on Alexa speakers as a publicly accessible MP3 URL:

sequence:
  - service: chime_tts.say_url
    data:
      chime_path: mp3_path_placeholder-bells_2
      tts_platform: google_translate
      message: This is a Chime TTS test on Alexa speakers
      language: en
    response_variable: chime_tts
  - service: notify.alexa_media
    data:
      message: |
        <audio src='{{chime_tts.url}}'/>
      target:
        - media_player.echo_show
        - media_player.echo_plus
        - media_player.bathroom_echo
        - media_player.bedroom_echo
      data:
        type: tts

chime_tts.clear_cache

The chime_tts.clear_cache service removes all generated audio cache files & references to cached TTS audio.

service: chime_tts.clear_cache
12 Likes

TTS I use the cloud
I only use the Nabu Casa cloud and it is not possible to select.
If it was possible to add the tts.cloud_say service startup.
I would try if it works.

Try entering: cloud_say as the TTS Platform value (without tts. before it).

I’m getting an ‘unknown error’ when trying to call this service. There is nothing being logged, however, at least as far as I can find.

What other troubleshooting steps should I take to try to get this working for me?

EDIT: I do find that there is nothing being logged when trying to play to one of the Sonos players, but if I try to play to something Echo-based ( a Show, Dot, etc.), there is an error logged like the following:

[custom_components.chime_tts] Unable to get current volume for media player 'media_player.allie_s_office_show'

In the system’s log page, can you please press: LOAD FULL LOGS and see if there’s anything else that could be helpful to understand what might be causing the “unknown error”?

Regarding the current volume error message: it indicates that Chime TTS cannot access that particular media_player’s volume_level attribute - but that just means it won’t adjust the volume before playing the notification. Do you end up hearing the notification on the speaker?

Using this action:

I get four separate errors in the log:
1:
This error originated from a custom integration.

Logger: custom_components.chime_tts
Source: custom_components/chime_tts/init.py:92
Integration: Chime TTS (documentation, issues)
First occurred: 11:27:04 AM (6 occurrences)
Last logged: 11:39:25 AM

No filepath provided

2
Logger: aiohttp.server
Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:403
First occurred: 11:13:48 AM (12 occurrences)
Last logged: 11:39:25 AM

Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py”, line 332, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “aiohttp/_http_parser.pyx”, line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message=“Bad status line ‘Invalid method encountered’”

3
This error originated from a custom integration.

Logger: homeassistant.helpers.script.websocket_api_script
Source: custom_components/chime_tts/init.py:198
Integration: Chime TTS (documentation, issues)
First occurred: 11:24:16 AM (11 occurrences)
Last logged: 11:39:25 AM

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: HTTPSConnectionPool(host=‘192.168.50.12’, port=8123): Max retries exceeded with url: /api/tts_get_url (Caused by SSLError(SSLError(1, ‘[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1002)’)))
Traceback (most recent call last):
File “/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 714, in urlopen
httplib_response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 403, in _make_request
self._validate_conn(conn)
File “/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 1053, in validate_conn
conn.connect()
File “/usr/local/lib/python3.11/site-packages/urllib3/connection.py”, line 419, in connect
self.sock = ssl_wrap_socket(
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/util/ssl
.py", line 453, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(sock, context, tls_in_tls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/util/ssl
.py", line 495, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/ssl.py”, line 517, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/ssl.py”, line 1075, in _create
self.do_handshake()
File “/usr/local/lib/python3.11/ssl.py”, line 1346, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1002)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.11/site-packages/requests/adapters.py”, line 486, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 798, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py”, line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘192.168.50.12’, port=8123): Max retries exceeded with url: /api/tts_get_url (Caused by SSLError(SSLError(1, ‘[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1002)’)))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 452, in _async_step
await getattr(self, handler)()
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 685, in _async_call_service_step
await service_task
File “/usr/src/homeassistant/homeassistant/core.py”, line 1910, in async_call
task.result()
File “/usr/src/homeassistant/homeassistant/core.py”, line 1950, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File “/config/custom_components/chime_tts/init.py”, line 92, in async_say
audio_path = await async_get_playback_audio_path(params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/config/custom_components/chime_tts/init.py”, line 231, in async_get_playback_audio_path
tts_audio_path = await async_request_tts_audio_filepath(hass, tts_platform, message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/config/custom_components/chime_tts/init.py”, line 178, in async_request_tts_audio_filepath
response = await hass.async_add_executor_job(post_request, url, headers, data, TIMEOUT)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/config/custom_components/chime_tts/init.py”, line 198, in post_request
return post(url, headers=headers, data=data, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/requests/api.py”, line 115, in post
return request(“post”, url, data=data, json=json, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/requests/api.py”, line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/requests/sessions.py”, line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/requests/sessions.py”, line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/requests/adapters.py”, line 517, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host=‘192.168.50.12’, port=8123): Max retries exceeded with url: /api/tts_get_url (Caused by SSLError(SSLError(1, ‘[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1002)’)))

4
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/chime_tts/init.py:198
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 11:24:16 AM (11 occurrences)
Last logged: 11:39:25 AM

[281472621075408] Error handling message: Unknown error (unknown_error) Jay from 192.168.50.9 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36)
[281471943784336] Error handling message: Unknown error (unknown_error) Jay from 192.168.50.9 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36)
Traceback (most recent call last):
File “/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 714, in urlopen
httplib_response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 403, in _make_request
self._validate_conn(conn)
File “/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 1053, in validate_conn
conn.connect()
File “/usr/local/lib/python3.11/site-packages/urllib3/connection.py”, line 419, in connect
self.sock = ssl_wrap_socket(
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/util/ssl
.py", line 453, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(sock, context, tls_in_tls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/util/ssl
.py", line 495, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/ssl.py”, line 517, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/ssl.py”, line 1075, in _create
self.do_handshake()
File “/usr/local/lib/python3.11/ssl.py”, line 1346, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1002)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.11/site-packages/requests/adapters.py”, line 486, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py”, line 798, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/urllib3/util/retry.py”, line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘192.168.50.12’, port=8123): Max retries exceeded with url: /api/tts_get_url (Caused by SSLError(SSLError(1, ‘[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1002)’)))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py”, line 26, in _handle_async_response
await func(hass, connection, msg)
File “/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py”, line 678, in handle_execute_script
await script_obj.async_run(msg.get(“variables”), context=context)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 1533, in async_run
await asyncio.shield(run.async_run())
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 410, in async_run
await self._async_step(log_exceptions=False)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 454, in _async_step
self._handle_exception(
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 477, in _handle_exception
raise exception
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 452, in _async_step
await getattr(self, handler)()
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 685, in _async_call_service_step
await service_task
File “/usr/src/homeassistant/homeassistant/core.py”, line 1910, in async_call
task.result()
File “/usr/src/homeassistant/homeassistant/core.py”, line 1950, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File “/config/custom_components/chime_tts/init.py”, line 92, in async_say
audio_path = await async_get_playback_audio_path(params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/config/custom_components/chime_tts/init.py”, line 231, in async_get_playback_audio_path
tts_audio_path = await async_request_tts_audio_filepath(hass, tts_platform, message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/config/custom_components/chime_tts/init.py”, line 178, in async_request_tts_audio_filepath
response = await hass.async_add_executor_job(post_request, url, headers, data, TIMEOUT)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/config/custom_components/chime_tts/init.py”, line 198, in post_request
return post(url, headers=headers, data=data, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/requests/api.py”, line 115, in post
return request(“post”, url, data=data, json=json, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/requests/api.py”, line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/requests/sessions.py”, line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/requests/sessions.py”, line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/requests/adapters.py”, line 517, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host=‘192.168.50.12’, port=8123): Max retries exceeded with url: /api/tts_get_url (Caused by SSLError(SSLError(1, ‘[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1002)’)))

Thank you for providing the log messages. I found the problem and released a new version (v0.3.1) which should fix your issue. Please update to the new version and let me know if you’re still having issues or if it’s now fixed.

2 Likes

After updating 0.3.1, its says “action run successfully” but no sound output. one error message

This error originated from a custom integration.

Logger: custom_components.chime_tts
Source: custom_components/chime_tts/init.py:92
Integration: Chime TTS (documentation, issues)
First occurred: 1:18:22 PM (12 occurrences)
Last logged: 1:25:04 PM

No filepath provided

Can you please enable debug logging for the integration, call the service again, and send the log messages?

service: logger.set_level
data:
  custom_components.chime_tts: debug

enabled debug logging per your directions. same error message

This error originated from a custom integration.

Logger: custom_components.chime_tts
Source: custom_components/chime_tts/init.py:92
Integration: Chime TTS (documentation, issues)
First occurred: 1:58:48 PM (6 occurrences)
Last logged: 2:03:16 PM

No filepath provided

Please note that upon executing the action, HA takes 5 full seconds to actually execute the command. my google translate actions are immediate for comparison

Can you please press the LOAD FULL LOGS button in the system’s log page and filter for ‘chime_tts’?

sorry about that!

2023-06-19 13:39:08.221 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration chime_tts which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

2023-06-19 13:58:48.724 WARNING (MainThread) [custom_components.chime_tts] No filepath provided

2023-06-19 13:58:49.160 WARNING (MainThread) [custom_components.chime_tts] No filepath provided

2023-06-19 14:00:13.589 DEBUG (MainThread) [custom_components.chime_tts] async_say(service)

2023-06-19 14:00:13.590 DEBUG (MainThread) [custom_components.chime_tts] async_get_playback_audio_path(params={‘hass’: <homeassistant.core.HomeAssistant object at 0xffff7d419ad0>, ‘chime_path’: ‘’, ‘end_chime_path’: ‘’, ‘delay’: 450.0, ‘tts_platform’: ‘google_translate’, ‘message’: ‘A door is open’})

2023-06-19 14:00:13.590 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path("", 0, audio)

2023-06-19 14:00:13.590 WARNING (MainThread) [custom_components.chime_tts] No filepath provided

2023-06-19 14:00:13.592 DEBUG (MainThread) [custom_components.chime_tts] async_get_tts_cache_path(‘Z29vZ2xlX3RyYW5zbGF0ZS1BIGRvb3IgaXMgb3Blbg==’)

2023-06-19 14:00:13.592 DEBUG (MainThread) [custom_components.chime_tts] Retrieving key/value from chime_tts storage:

2023-06-19 14:00:13.592 DEBUG (MainThread) [custom_components.chime_tts] key: Z29vZ2xlX3RyYW5zbGF0ZS1BIGRvb3IgaXMgb3Blbg==

2023-06-19 14:00:13.592 DEBUG (MainThread) [custom_components.chime_tts] value: /config/tts/38a3d9352dd22a2bf54d93e8175b78024dec3ecf_en_-_google_translate.mp3

2023-06-19 14:00:13.592 DEBUG (MainThread) [custom_components.chime_tts] - async_get_tts_cache_path(‘Z29vZ2xlX3RyYW5zbGF0ZS1BIGRvb3IgaXMgb3Blbg==’) returned value: ‘/config/tts/38a3d9352dd22a2bf54d93e8175b78024dec3ecf_en_-_google_translate.mp3’

2023-06-19 14:00:13.592 DEBUG (MainThread) [custom_components.chime_tts] - Using cached TTS mp3 filepath

2023-06-19 14:00:13.592 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path("/config/tts/38a3d9352dd22a2bf54d93e8175b78024dec3ecf_en_-_google_translate.mp3", 450.0, audio)

2023-06-19 14:00:13.592 DEBUG (MainThread) [custom_components.chime_tts] Retrieving audio from path: “/config/tts/38a3d9352dd22a2bf54d93e8175b78024dec3ecf_en_-_google_translate.mp3”…

2023-06-19 14:00:13.912 DEBUG (MainThread) [custom_components.chime_tts] - …audio retrieved successfully

2023-06-19 14:00:13.913 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path("", 450.0, audio)

2023-06-19 14:00:13.913 WARNING (MainThread) [custom_components.chime_tts] No filepath provided

2023-06-19 14:00:13.915 DEBUG (MainThread) [custom_components.chime_tts] - Final audio created with duration = 1.416s

2023-06-19 14:00:14.085 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level(“media_player.garage_fire_tablet”, -1.0)

2023-06-19 14:00:14.085 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level: slipped

2023-06-19 14:00:14.085 DEBUG (MainThread) [custom_components.chime_tts] Playing media…

2023-06-19 14:00:14.085 DEBUG (MainThread) [custom_components.chime_tts] - audio_path = “/tmp/tmpg7n2idyg.mp3”

2023-06-19 14:00:14.085 DEBUG (MainThread) [custom_components.chime_tts] - entity_id = “media_player.garage_fire_tablet”

2023-06-19 14:00:14.192 DEBUG (MainThread) [custom_components.chime_tts] …media finished playback:

2023-06-19 14:00:15.610 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level(“media_player.garage_fire_tablet”, 0.75)

2023-06-19 14:00:15.610 DEBUG (MainThread) [custom_components.chime_tts] - Seting volume_level of media player “media_player.garage_fire_tablet” to: 0.75

2023-06-19 14:00:17.457 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level: completed

2023-06-19 14:01:56.495 DEBUG (MainThread) [custom_components.chime_tts] async_say(service)

2023-06-19 14:01:56.495 DEBUG (MainThread) [custom_components.chime_tts] async_get_playback_audio_path(params={‘hass’: <homeassistant.core.HomeAssistant object at 0xffff7d419ad0>, ‘chime_path’: ‘custom_components/chime_tts/mp3s/bells.mp3’, ‘end_chime_path’: ‘’, ‘delay’: 450.0, ‘tts_platform’: ‘google_translate’, ‘message’: ‘A door is open’})

2023-06-19 14:01:56.495 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path(“custom_components/chime_tts/mp3s/bells.mp3”, 0, audio)

2023-06-19 14:01:56.495 DEBUG (MainThread) [custom_components.chime_tts] Retrieving audio from path: “custom_components/chime_tts/mp3s/bells.mp3”…

2023-06-19 14:01:56.735 DEBUG (MainThread) [custom_components.chime_tts] - …audio retrieved successfully

2023-06-19 14:01:56.736 DEBUG (MainThread) [custom_components.chime_tts] async_get_tts_cache_path(‘Z29vZ2xlX3RyYW5zbGF0ZS1BIGRvb3IgaXMgb3Blbg==’)

2023-06-19 14:01:56.736 DEBUG (MainThread) [custom_components.chime_tts] Retrieving key/value from chime_tts storage:

2023-06-19 14:01:56.736 DEBUG (MainThread) [custom_components.chime_tts] key: Z29vZ2xlX3RyYW5zbGF0ZS1BIGRvb3IgaXMgb3Blbg==

2023-06-19 14:01:56.736 DEBUG (MainThread) [custom_components.chime_tts] value: /config/tts/38a3d9352dd22a2bf54d93e8175b78024dec3ecf_en_-_google_translate.mp3

2023-06-19 14:01:56.736 DEBUG (MainThread) [custom_components.chime_tts] - async_get_tts_cache_path(‘Z29vZ2xlX3RyYW5zbGF0ZS1BIGRvb3IgaXMgb3Blbg==’) returned value: ‘/config/tts/38a3d9352dd22a2bf54d93e8175b78024dec3ecf_en_-_google_translate.mp3’

2023-06-19 14:01:56.737 DEBUG (MainThread) [custom_components.chime_tts] - Using cached TTS mp3 filepath

2023-06-19 14:01:56.737 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path("/config/tts/38a3d9352dd22a2bf54d93e8175b78024dec3ecf_en_-_google_translate.mp3", 450.0, audio)

2023-06-19 14:01:56.738 DEBUG (MainThread) [custom_components.chime_tts] Retrieving audio from path: “/config/tts/38a3d9352dd22a2bf54d93e8175b78024dec3ecf_en_-_google_translate.mp3”…

2023-06-19 14:01:57.015 DEBUG (MainThread) [custom_components.chime_tts] - …audio retrieved successfully

2023-06-19 14:01:57.017 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path("", 450.0, audio)

2023-06-19 14:01:57.017 WARNING (MainThread) [custom_components.chime_tts] No filepath provided

2023-06-19 14:01:57.022 DEBUG (MainThread) [custom_components.chime_tts] - Final audio created with duration = 2.81s

2023-06-19 14:01:57.206 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level(“media_player.garage_fire_tablet”, -1.0)

2023-06-19 14:01:57.206 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level: slipped

2023-06-19 14:01:57.207 DEBUG (MainThread) [custom_components.chime_tts] Playing media…

2023-06-19 14:01:57.207 DEBUG (MainThread) [custom_components.chime_tts] - audio_path = “/tmp/tmpzodnae9w.mp3”

2023-06-19 14:01:57.207 DEBUG (MainThread) [custom_components.chime_tts] - entity_id = “media_player.garage_fire_tablet”

2023-06-19 14:01:58.115 DEBUG (MainThread) [custom_components.chime_tts] …media finished playback:

2023-06-19 14:02:00.927 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level(“media_player.garage_fire_tablet”, 0.75)

2023-06-19 14:02:00.927 DEBUG (MainThread) [custom_components.chime_tts] - Seting volume_level of media player “media_player.garage_fire_tablet” to: 0.75

2023-06-19 14:02:02.221 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level: completed

2023-06-19 14:03:16.436 DEBUG (MainThread) [custom_components.chime_tts] async_say(service)

2023-06-19 14:03:16.436 DEBUG (MainThread) [custom_components.chime_tts] async_get_playback_audio_path(params={‘hass’: <homeassistant.core.HomeAssistant object at 0xffff7d419ad0>, ‘chime_path’: ‘custom_components/chime_tts/mp3s/bells.mp3’, ‘end_chime_path’: ‘’, ‘delay’: 450.0, ‘tts_platform’: ‘google_translate’, ‘message’: ‘testing’})

2023-06-19 14:03:16.436 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path(“custom_components/chime_tts/mp3s/bells.mp3”, 0, audio)

2023-06-19 14:03:16.438 DEBUG (MainThread) [custom_components.chime_tts] Retrieving audio from path: “custom_components/chime_tts/mp3s/bells.mp3”…

2023-06-19 14:03:16.676 DEBUG (MainThread) [custom_components.chime_tts] - …audio retrieved successfully

2023-06-19 14:03:16.676 DEBUG (MainThread) [custom_components.chime_tts] async_get_tts_cache_path(‘Z29vZ2xlX3RyYW5zbGF0ZS10ZXN0aW5n’)

2023-06-19 14:03:16.676 DEBUG (MainThread) [custom_components.chime_tts] Retrieving key/value from chime_tts storage:

2023-06-19 14:03:16.677 DEBUG (MainThread) [custom_components.chime_tts] key: Z29vZ2xlX3RyYW5zbGF0ZS10ZXN0aW5n

2023-06-19 14:03:16.677 DEBUG (MainThread) [custom_components.chime_tts] value: /config/tts/dc724af18fbdd4e59189f5fe768a5f8311527050_en_-_google_translate.mp3

2023-06-19 14:03:16.677 DEBUG (MainThread) [custom_components.chime_tts] - async_get_tts_cache_path(‘Z29vZ2xlX3RyYW5zbGF0ZS10ZXN0aW5n’) returned value: ‘/config/tts/dc724af18fbdd4e59189f5fe768a5f8311527050_en_-_google_translate.mp3’

2023-06-19 14:03:16.677 DEBUG (MainThread) [custom_components.chime_tts] - Using cached TTS mp3 filepath

2023-06-19 14:03:16.677 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path("/config/tts/dc724af18fbdd4e59189f5fe768a5f8311527050_en_-_google_translate.mp3", 450.0, audio)

2023-06-19 14:03:16.678 DEBUG (MainThread) [custom_components.chime_tts] Retrieving audio from path: “/config/tts/dc724af18fbdd4e59189f5fe768a5f8311527050_en_-_google_translate.mp3”…

2023-06-19 14:03:16.914 DEBUG (MainThread) [custom_components.chime_tts] - …audio retrieved successfully

2023-06-19 14:03:16.919 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path("", 450.0, audio)

2023-06-19 14:03:16.920 WARNING (MainThread) [custom_components.chime_tts] No filepath provided

2023-06-19 14:03:16.921 DEBUG (MainThread) [custom_components.chime_tts] - Final audio created with duration = 2.33s

2023-06-19 14:03:17.115 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level(“media_player.garage_fire_tablet”, -1.0)

2023-06-19 14:03:17.116 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level: slipped

2023-06-19 14:03:17.116 DEBUG (MainThread) [custom_components.chime_tts] Playing media…

2023-06-19 14:03:17.116 DEBUG (MainThread) [custom_components.chime_tts] - audio_path = “/tmp/tmprrtgj3p0.mp3”

2023-06-19 14:03:17.116 DEBUG (MainThread) [custom_components.chime_tts] - entity_id = “media_player.garage_fire_tablet”

2023-06-19 14:03:17.888 DEBUG (MainThread) [custom_components.chime_tts] …media finished playback:

2023-06-19 14:03:20.220 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level(“media_player.garage_fire_tablet”, 0.75)

2023-06-19 14:03:20.220 DEBUG (MainThread) [custom_components.chime_tts] - Seting volume_level of media player “media_player.garage_fire_tablet” to: 0.75

2023-06-19 14:03:20.652 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level: completed

Unfortunately nothing looks wrong in the log messages. I don’t have a fire tablet so I can’t test the issue but behind the scenes the integration calls the native media player’s play media service. Are you able to play TTS messages (or plain media files) normally on the tablet?
As for the delay, it’s an open issue but unrelated to your issue of no audio playing.

I recently removed it because NabuCasa tts was not working.
Haven’t gotten around to it yet but will install and test tomorrow.
I will let you know how it works, or if there are any errors.

Just downloaded, installed and rebooted. I am seeing the exact same thing, audio file is created, the filename and path are correct, but sound output is not heard. Here is the log dump from just a few minutes ago.

2023-06-20 20:19:32.197 DEBUG (MainThread) [custom_components.chime_tts] async_say(service)
2023-06-20 20:19:32.197 DEBUG (MainThread) [custom_components.chime_tts] async_get_playback_audio_path(params={'hass': <homeassistant.core.HomeAssistant object at 0x7f8704b610>, 'chime_path': 'custom_components/chime_tts/mp3s/ding_dong.mp3', 'end_chime_path': '', 'delay': 450.0, 'tts_platform': 'google_cloud', 'message': 'Hello Art. How are you doing?'})
2023-06-20 20:19:32.197 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path("custom_components/chime_tts/mp3s/ding_dong.mp3", 0, audio)
2023-06-20 20:19:32.198 DEBUG (MainThread) [custom_components.chime_tts] Retrieving audio from path: "custom_components/chime_tts/mp3s/ding_dong.mp3"...
2023-06-20 20:19:32.566 DEBUG (MainThread) [custom_components.chime_tts] - ...audio retrieved successfully
2023-06-20 20:19:32.567 DEBUG (MainThread) [custom_components.chime_tts] async_get_tts_cache_path('Z29vZ2xlX2Nsb3VkLUhlbGxvIEFydC4gSG93IGFyZSB5b3UgZG9pbmc/')
2023-06-20 20:19:32.567 DEBUG (MainThread) [custom_components.chime_tts] Retrieving key/value from chime_tts storage:
2023-06-20 20:19:32.567 DEBUG (MainThread) [custom_components.chime_tts] key: Z29vZ2xlX2Nsb3VkLUhlbGxvIEFydC4gSG93IGFyZSB5b3UgZG9pbmc/
2023-06-20 20:19:32.567 DEBUG (MainThread) [custom_components.chime_tts] value: /config/tts/701649d11d32e06ba0a1bdbea89a09cb209f67d3_en-us_bcdbf0dd85_google_cloud.mp3
2023-06-20 20:19:32.567 DEBUG (MainThread) [custom_components.chime_tts] - async_get_tts_cache_path('Z29vZ2xlX2Nsb3VkLUhlbGxvIEFydC4gSG93IGFyZSB5b3UgZG9pbmc/') returned value: '/config/tts/701649d11d32e06ba0a1bdbea89a09cb209f67d3_en-us_bcdbf0dd85_google_cloud.mp3'
2023-06-20 20:19:32.567 DEBUG (MainThread) [custom_components.chime_tts] - Using cached TTS mp3 filepath
2023-06-20 20:19:32.567 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path("/config/tts/701649d11d32e06ba0a1bdbea89a09cb209f67d3_en-us_bcdbf0dd85_google_cloud.mp3", 450.0, audio)
2023-06-20 20:19:32.568 DEBUG (MainThread) [custom_components.chime_tts] Retrieving audio from path: "/config/tts/701649d11d32e06ba0a1bdbea89a09cb209f67d3_en-us_bcdbf0dd85_google_cloud.mp3"...
2023-06-20 20:19:32.908 DEBUG (MainThread) [custom_components.chime_tts] - ...audio retrieved successfully
2023-06-20 20:19:32.925 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path("", 450.0, audio)
2023-06-20 20:19:32.926 WARNING (MainThread) [custom_components.chime_tts] No filepath provided
2023-06-20 20:19:32.930 DEBUG (MainThread) [custom_components.chime_tts] - Final audio created with duration = 4.071s
2023-06-20 20:19:33.320 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level("media_player.office", 0.26)
2023-06-20 20:19:33.320 DEBUG (MainThread) [custom_components.chime_tts] - Seting volume_level of media player "media_player.office" to: 0.26
2023-06-20 20:19:33.353 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level: completed
2023-06-20 20:19:33.353 DEBUG (MainThread) [custom_components.chime_tts] Playing media...
2023-06-20 20:19:33.353 DEBUG (MainThread) [custom_components.chime_tts] - audio_path = "/tmp/tmpmjkzd_71.mp3"
2023-06-20 20:19:33.353 DEBUG (MainThread) [custom_components.chime_tts] - entity_id = "media_player.office"
2023-06-20 20:19:33.414 DEBUG (MainThread) [custom_components.chime_tts] ...media finished playback:

Hopefully additional users and log files can help isolate the cause. I really like this idea and hope you can get it resolved.

@kartcon, I agree that your log messages don’t indicate an issue, but I will take a look into it.

Could you please verify whether you are able to play a local .mp3 file on that media player, using Home Assistant’s native media_player.play_media service?

For example:

service: media_player.play_media
data:
  media_content_id: /local/a_local_audio_file.mp3
  media_content_type: music
target:
  entity_id: media_player.office

Hi, after last update works great.
It’s possible to work with dialects?

My configuration.yaml is:

tts:

  • platform: google_translate
    language: “pt”
    tld: pt

like explained here

But Brazilian is spoken

Thanks

@juaurodri, I added the functionalty for language support to a new release v0.3.2. You should see an update in HACS.

Thanks for that!

I found 2 bugs:
File “/config/custom_components/chime_tts/init.py”, line 302, in async_get_playback_audio_path
filename_bytes = filename.encode(‘ascii’)
^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: ‘ascii’ codec can’t encode character ‘\xe1’ in position 32: ordinal not in range(128)

Filename dont accept words like Olá or João

And this one:
Audio filepath does not exist: “/config/tts/796cb494dc874f990bfd552d48105731bb65ad1e_pt_693225a70b_google_translate.mp3”

And
Source: custom_components/chime_tts/init.py:113
Integration: Chime TTS (documentation, issues)
First occurred: 9:20:52 PM (1 occurrences)
Last logged: 9:20:52 PM

Unable to create audio for playback

Thanks

Hey @juaurodri, thanks for reporting the issues :+1:

I fixed the first issue and I think the second one might be related, so hopefully it’s also fixed.
Could you please upgrade to the new version (v0.3.3) and let me know if if you’re still having any issues?

If you are still having issues after upgrading, please first turn on debug logging, then run the service and reply with the log messages so I might have a better idea of what could be going on.