@Nimrod_Dolev Ok so some progress with v0.5.2! With this new version, I can get the audio to play on my other speakers but only if cache: true
is set. If the cache
parameter is not set or set to false, no sound plays at all.
Additionally, even with cache: true
, calling chime_tts with a new TTS phrase that is not in cache doesn’t play the text - instead I only hear the start bell and then silence. This seems to only happen when I use piper (manually typing tts.piper
as the tts platform) and not with google translate. Piper works fine as a TTS service with new messages when used standalone.
Still no errors, but I included logs below for a few cases for reference:
cache: true, existing cached phrase: Audio plays normally
2023-07-18 09:36:45.122 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Called -----
2023-07-18 09:36:45.122 DEBUG (MainThread) [custom_components.chime_tts] async_get_playback_audio_path(params={'hass': <homeassistant.core.HomeAssistant object at 0x7ff63598ee50>, 'chime_path': 'custom_components/chime_tts/mp3s/bells.mp3', 'end_chime_path': '', 'delay': 450.0, 'tts_platform': 'google_translate', 'tts_playback_speed': 100.0, 'cache': True, 'message': 'Hello world!', 'language': None, 'tld': None, 'gender': None})
2023-07-18 09:36:45.122 DEBUG (MainThread) [custom_components.chime_tts] Attempting to retrieve generated mp3 file from cache
2023-07-18 09:36:45.122 DEBUG (MainThread) [custom_components.chime_tts] async_get_cached_path('6b2e0347634bcc2d1ed37393ea8b757c7c2b8a20fac624e5121ad1127dd06ab9')
2023-07-18 09:36:45.122 DEBUG (MainThread) [custom_components.chime_tts] Retrieving key/value from chime_tts storage:
2023-07-18 09:36:45.122 DEBUG (MainThread) [custom_components.chime_tts] key: 6b2e0347634bcc2d1ed37393ea8b757c7c2b8a20fac624e5121ad1127dd06ab9
2023-07-18 09:36:45.122 DEBUG (MainThread) [custom_components.chime_tts] value: /media/sounds/temp/chime_tts/iezy6ns7.mp3
2023-07-18 09:36:45.122 DEBUG (MainThread) [custom_components.chime_tts] Returning cached filepath: '/media/sounds/temp/chime_tts/iezy6ns7.mp3'
2023-07-18 09:36:45.122 DEBUG (MainThread) [custom_components.chime_tts] Using previously generated mp3 saved in cache
2023-07-18 09:36:45.122 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level("media_player.workshop_sonos", 0.3)
2023-07-18 09:36:45.122 DEBUG (MainThread) [custom_components.chime_tts] - Seting volume_level of media player "media_player.workshop_sonos" to: 0.3
2023-07-18 09:36:45.137 DEBUG (MainThread) [custom_components.chime_tts] - Completed
2023-07-18 09:36:45.137 DEBUG (MainThread) [custom_components.chime_tts] Playing media...
2023-07-18 09:36:45.137 DEBUG (MainThread) [custom_components.chime_tts] - media_path = "media-source://media_source/local/sounds/temp/chime_tts/iezy6ns7.mp3"
2023-07-18 09:36:45.137 DEBUG (MainThread) [custom_components.chime_tts] - entity_id = "media_player.workshop_sonos"
2023-07-18 09:36:45.160 DEBUG (MainThread) [custom_components.chime_tts] ...media finished playback:
2023-07-18 09:36:45.160 DEBUG (MainThread) [custom_components.chime_tts] Waiting 0s until returning volume level to 0.32...
2023-07-18 09:36:45.161 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level("media_player.workshop_sonos", 0.32)
2023-07-18 09:36:45.161 DEBUG (MainThread) [custom_components.chime_tts] - Seting volume_level of media player "media_player.workshop_sonos" to: 0.32
2023-07-18 09:36:45.177 DEBUG (MainThread) [custom_components.chime_tts] - Completed
2023-07-18 09:36:45.177 DEBUG (MainThread) [custom_components.chime_tts] ...volume level restored
2023-07-18 09:36:45.177 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Completed in 55.468999999999994 ms -----
cache: false, existing cached phrase: No sound at all
2023-07-18 09:37:38.019 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Called -----
2023-07-18 09:37:38.019 DEBUG (MainThread) [custom_components.chime_tts] async_get_playback_audio_path(params={'hass': <homeassistant.core.HomeAssistant object at 0x7ff63598ee50>, 'chime_path': 'custom_components/chime_tts/mp3s/bells.mp3', 'end_chime_path': '', 'delay': 450.0, 'tts_platform': 'google_translate', 'tts_playback_speed': 100.0, 'cache': False, 'message': 'Hello world!', 'language': None, 'tld': None, 'gender': None})
2023-07-18 09:37:38.019 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path("custom_components/chime_tts/mp3s/bells.mp3", 0, audio)
2023-07-18 09:37:38.019 DEBUG (MainThread) [custom_components.chime_tts] Retrieving audio from path: "custom_components/chime_tts/mp3s/bells.mp3"...
2023-07-18 09:37:38.110 DEBUG (MainThread) [custom_components.chime_tts] - ...audio retrieved successfully
2023-07-18 09:37:38.110 DEBUG (MainThread) [custom_components.chime_tts] async_request_tts_audio_filepath(hass, tts_platform="google_translate", message="Hello world!", language="None", tld="None", gender="None"))
2023-07-18 09:37:38.111 DEBUG (MainThread) [custom_components.chime_tts] Requesting TTS audio:
2023-07-18 09:37:38.111 DEBUG (MainThread) [custom_components.chime_tts] * url = http://192.168.55.150:8123/api/tts_get_url
2023-07-18 09:37:38.111 DEBUG (MainThread) [custom_components.chime_tts] * headers = {'Authorization': 'Bearer eyJhb##########TsXEU', 'Content-Type': 'application/json'}
2023-07-18 09:37:38.111 DEBUG (MainThread) [custom_components.chime_tts] * data = {"message": "Hello world!", "platform": "google_translate", "cache": true}
2023-07-18 09:37:38.111 DEBUG (MainThread) [custom_components.chime_tts] * timeout = 10
2023-07-18 09:37:38.118 DEBUG (MainThread) [custom_components.chime_tts] - Repsonse status_code: "200"
2023-07-18 09:37:38.118 DEBUG (MainThread) [custom_components.chime_tts] - Repsonse received: "{"url":"http://192.168.55.150:8123/api/tts_proxy/d3486ae9136e7856bc42212385ea797094475802_en_-_google_translate.mp3","path":"/api/tts_proxy/d3486ae9136e7856bc42212385ea797094475802_en_-_google_translate.mp3"}"
2023-07-18 09:37:38.118 DEBUG (MainThread) [custom_components.chime_tts] - REST API request to /api/tts_get_url returned audio path: '/config/tts/d3486ae9136e7856bc42212385ea797094475802_en_-_google_translate.mp3'
2023-07-18 09:37:38.118 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path("/config/tts/d3486ae9136e7856bc42212385ea797094475802_en_-_google_translate.mp3", 450.0, audio)
2023-07-18 09:37:38.118 DEBUG (MainThread) [custom_components.chime_tts] Retrieving audio from path: "/config/tts/d3486ae9136e7856bc42212385ea797094475802_en_-_google_translate.mp3"...
2023-07-18 09:37:38.209 DEBUG (MainThread) [custom_components.chime_tts] - ...audio retrieved successfully
2023-07-18 09:37:38.210 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path("", 450.0, audio)
2023-07-18 09:37:38.210 DEBUG (MainThread) [custom_components.chime_tts] - Final audio created:
2023-07-18 09:37:38.210 DEBUG (MainThread) [custom_components.chime_tts] - Duration = 2.666s
2023-07-18 09:37:38.210 DEBUG (MainThread) [custom_components.chime_tts] - Filepath = '/media/sounds/temp/chime_tts/29_27egb.mp3'
2023-07-18 09:37:38.277 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level("media_player.workshop_sonos", 0.3)
2023-07-18 09:37:38.277 DEBUG (MainThread) [custom_components.chime_tts] - Seting volume_level of media player "media_player.workshop_sonos" to: 0.3
2023-07-18 09:37:38.290 DEBUG (MainThread) [custom_components.chime_tts] - Completed
2023-07-18 09:37:38.290 DEBUG (MainThread) [custom_components.chime_tts] Playing media...
2023-07-18 09:37:38.290 DEBUG (MainThread) [custom_components.chime_tts] - media_path = "media-source://media_source/local/sounds/temp/chime_tts/29_27egb.mp3"
2023-07-18 09:37:38.290 DEBUG (MainThread) [custom_components.chime_tts] - entity_id = "media_player.workshop_sonos"
2023-07-18 09:37:38.315 DEBUG (MainThread) [custom_components.chime_tts] ...media finished playback:
2023-07-18 09:37:38.316 DEBUG (MainThread) [custom_components.chime_tts] Waiting 2.666s until returning volume level to 0.32...
2023-07-18 09:37:40.982 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level("media_player.workshop_sonos", 0.32)
2023-07-18 09:37:40.982 DEBUG (MainThread) [custom_components.chime_tts] - Seting volume_level of media player "media_player.workshop_sonos" to: 0.32
2023-07-18 09:37:40.993 DEBUG (MainThread) [custom_components.chime_tts] - Completed
2023-07-18 09:37:40.993 DEBUG (MainThread) [custom_components.chime_tts] ...volume level restored
2023-07-18 09:37:40.993 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Completed in 2974.2099999999996 ms -----
cache: true, new (uncached) phrase with Piper: Only bell sounds plays
2023-07-18 09:39:30.761 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Called -----
2023-07-18 09:39:30.761 DEBUG (MainThread) [custom_components.chime_tts] async_get_playback_audio_path(params={'hass': <homeassistant.core.HomeAssistant object at 0x7ff63598ee50>, 'chime_path': 'custom_components/chime_tts/mp3s/bells.mp3', 'end_chime_path': '', 'delay': 450.0, 'tts_platform': 'tts.piper', 'tts_playback_speed': 100.0, 'cache': True, 'message': "This is a new message that I haven't used before 3432", 'language': None, 'tld': None, 'gender': None})
2023-07-18 09:39:30.761 DEBUG (MainThread) [custom_components.chime_tts] Attempting to retrieve generated mp3 file from cache
2023-07-18 09:39:30.761 DEBUG (MainThread) [custom_components.chime_tts] async_get_cached_path('0fef3e24da5e7df76d4b861e732114b289be201ecfdda7f8653fa2e284b1fafb')
2023-07-18 09:39:30.761 DEBUG (MainThread) [custom_components.chime_tts] - Filepath not found in cache.
2023-07-18 09:39:30.761 DEBUG (MainThread) [custom_components.chime_tts] No previously generated mp3 file found
2023-07-18 09:39:30.761 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path("custom_components/chime_tts/mp3s/bells.mp3", 0, audio)
2023-07-18 09:39:30.761 DEBUG (MainThread) [custom_components.chime_tts] Retrieving audio from path: "custom_components/chime_tts/mp3s/bells.mp3"...
2023-07-18 09:39:30.852 DEBUG (MainThread) [custom_components.chime_tts] - ...audio retrieved successfully
2023-07-18 09:39:30.852 DEBUG (MainThread) [custom_components.chime_tts] async_get_cached_path('2825064cfa1f5037bde25b0987ac21a8d42a53b3c42effa163db4cb763fd9e8f')
2023-07-18 09:39:30.853 DEBUG (MainThread) [custom_components.chime_tts] - Filepath not found in cache.
2023-07-18 09:39:30.853 DEBUG (MainThread) [custom_components.chime_tts] - Cached TTS mp3 file not found
2023-07-18 09:39:30.853 DEBUG (MainThread) [custom_components.chime_tts] async_request_tts_audio_filepath(hass, tts_platform="tts.piper", message="This is a new message that I haven't used before 3432", language="None", tld="None", gender="None"))
2023-07-18 09:39:30.853 DEBUG (MainThread) [custom_components.chime_tts] Requesting TTS audio:
2023-07-18 09:39:30.853 DEBUG (MainThread) [custom_components.chime_tts] * url = http://192.168.55.150:8123/api/tts_get_url
2023-07-18 09:39:30.853 DEBUG (MainThread) [custom_components.chime_tts] * headers = {'Authorization': 'Bearer eyJhb##########TsXEU', 'Content-Type': 'application/json'}
2023-07-18 09:39:30.853 DEBUG (MainThread) [custom_components.chime_tts] * data = {"message": "This is a new message that I haven't used before 3432", "platform": "tts.piper", "cache": true}
2023-07-18 09:39:30.853 DEBUG (MainThread) [custom_components.chime_tts] * timeout = 10
2023-07-18 09:39:30.864 DEBUG (MainThread) [custom_components.chime_tts] - Repsonse status_code: "200"
2023-07-18 09:39:30.864 DEBUG (MainThread) [custom_components.chime_tts] - Repsonse received: "{"url":"http://192.168.55.150:8123/api/tts_proxy/e3956873cd52487fee7032986a28cba58b1069b6_en-us_a877e2b3bf_tts.piper.wav","path":"/api/tts_proxy/e3956873cd52487fee7032986a28cba58b1069b6_en-us_a877e2b3bf_tts.piper.wav"}"
2023-07-18 09:39:30.864 DEBUG (MainThread) [custom_components.chime_tts] - REST API request to /api/tts_get_url returned audio path: '/config/tts/e3956873cd52487fee7032986a28cba58b1069b6_en-us_a877e2b3bf_tts.piper.wav'
2023-07-18 09:39:30.864 DEBUG (MainThread) [custom_components.chime_tts] Saving to chime_tts storage:
2023-07-18 09:39:30.864 DEBUG (MainThread) [custom_components.chime_tts] key: "2825064cfa1f5037bde25b0987ac21a8d42a53b3c42effa163db4cb763fd9e8f"
2023-07-18 09:39:30.864 DEBUG (MainThread) [custom_components.chime_tts] value: "/config/tts/e3956873cd52487fee7032986a28cba58b1069b6_en-us_a877e2b3bf_tts.piper.wav"
2023-07-18 09:39:30.868 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path("/config/tts/e3956873cd52487fee7032986a28cba58b1069b6_en-us_a877e2b3bf_tts.piper.wav", 450.0, audio)
2023-07-18 09:39:30.869 WARNING (MainThread) [custom_components.chime_tts] Audio filepath does not exist: "/config/tts/e3956873cd52487fee7032986a28cba58b1069b6_en-us_a877e2b3bf_tts.piper.wav"
2023-07-18 09:39:30.870 DEBUG (MainThread) [custom_components.chime_tts] get_audio_from_path("", 450.0, audio)
2023-07-18 09:39:30.871 DEBUG (MainThread) [custom_components.chime_tts] - Final audio created:
2023-07-18 09:39:30.871 DEBUG (MainThread) [custom_components.chime_tts] - Duration = 0.944s
2023-07-18 09:39:30.871 DEBUG (MainThread) [custom_components.chime_tts] - Filepath = '/media/sounds/temp/chime_tts/0o4muj9x.mp3'
2023-07-18 09:39:30.956 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level("media_player.workshop_sonos", 0.3)
2023-07-18 09:39:30.956 DEBUG (MainThread) [custom_components.chime_tts] - Seting volume_level of media player "media_player.workshop_sonos" to: 0.3
2023-07-18 09:39:30.966 DEBUG (MainThread) [custom_components.chime_tts] - Completed
2023-07-18 09:39:30.966 DEBUG (MainThread) [custom_components.chime_tts] Playing media...
2023-07-18 09:39:30.966 DEBUG (MainThread) [custom_components.chime_tts] - media_path = "media-source://media_source/local/sounds/temp/chime_tts/0o4muj9x.mp3"
2023-07-18 09:39:30.966 DEBUG (MainThread) [custom_components.chime_tts] - entity_id = "media_player.workshop_sonos"
2023-07-18 09:39:30.986 DEBUG (MainThread) [custom_components.chime_tts] ...media finished playback:
2023-07-18 09:39:30.987 DEBUG (MainThread) [custom_components.chime_tts] Saving generated mp3 file to cache
2023-07-18 09:39:30.987 DEBUG (MainThread) [custom_components.chime_tts] Saving to chime_tts storage:
2023-07-18 09:39:30.987 DEBUG (MainThread) [custom_components.chime_tts] key: "0fef3e24da5e7df76d4b861e732114b289be201ecfdda7f8653fa2e284b1fafb"
2023-07-18 09:39:30.987 DEBUG (MainThread) [custom_components.chime_tts] value: "/media/sounds/temp/chime_tts/0o4muj9x.mp3"
2023-07-18 09:39:30.991 DEBUG (MainThread) [custom_components.chime_tts] Waiting 0.944s until returning volume level to 0.32...
2023-07-18 09:39:31.936 DEBUG (MainThread) [custom_components.chime_tts] - async_set_volume_level("media_player.workshop_sonos", 0.32)
2023-07-18 09:39:31.936 DEBUG (MainThread) [custom_components.chime_tts] - Seting volume_level of media player "media_player.workshop_sonos" to: 0.32
2023-07-18 09:39:31.944 DEBUG (MainThread) [custom_components.chime_tts] - Completed
2023-07-18 09:39:31.944 DEBUG (MainThread) [custom_components.chime_tts] ...volume level restored
2023-07-18 09:39:31.944 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Completed in 1182.948 ms -----