Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use the TTS Service #116

Closed
4 tasks done
bvdkerkhof opened this issue Apr 15, 2024 · 19 comments
Closed
4 tasks done

Unable to use the TTS Service #116

bvdkerkhof opened this issue Apr 15, 2024 · 19 comments
Labels
bug Something isn't working

Comments

@bvdkerkhof
Copy link

System Health details

System Information

version core-2024.4.2
installation_type Home Assistant Core
dev false
hassio false
docker false
user homeassistant
virtualenv true
python_version 3.12.2
os_name Linux
os_version 6.6.16-v7+
arch armv7l
timezone Europe/Amsterdam
config_dir /home/homeassistant/.homeassistant
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 4970
Installed Version 1.34.0
Stage running
Available Repositories 1408
Downloaded Repositories 95
HACS Data ok
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Dashboards
dashboards 9
resources 69
views 51
mode storage
Recorder
oldest_recorder_run 5 april 2024 om 11:41
current_recorder_run 15 april 2024 om 09:49
estimated_db_size 1993.14 MiB
database_engine postgresql
database_version 13.11
Spotify
api_endpoint_reachable ok

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of currently previous issues..

Describe the issue

Unable to play sound, getting error on API.

Reproduction steps

  1. Run the chime_tts service
  2. error occurs and check the logs

...

Debug logs

Logger: homeassistant.components.websocket_api.http.connection
Bron: custom_components/chime_tts/__init__.py:611
integratie: Home Assistant WebSocket API (documentatie, problemen)
Eerst voorgekomen: 09:51:54 (3 gebeurtenissen)
Laatst gelogd: 09:56:55

[858543016] Error handling message: Unknown error (unknown_error) Bram from 127.0.0.1 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36)
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
    await func(hass, connection, msg)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/websocket_api/commands.py", line 794, in handle_execute_script
    script_result = await script_obj.async_run(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 1713, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 457, in async_run
    await self._async_step(log_exceptions=False)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 509, in _async_step
    self._handle_exception(
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 539, in _handle_exception
    raise exception
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 507, in _async_step
    await getattr(self, handler)()
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 736, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 699, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 116, in async_say
    result = await queue.add_to_queue(async_say_execute, service, is_say_url)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/queue_manager.py", line 33, in async_process_queue
    result = await asyncio.wait_for(
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 138, in async_say_execute
    audio_dict = await async_get_playback_audio_path(params, options)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 756, in async_get_playback_audio_path
    output_audio = await async_process_segments(hass,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 948, in async_process_segments
    tts_audio = await async_request_tts_audio(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 611, in async_request_tts_audio
    audio = AudioSegment.from_file(file)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/pydub/audio_segment.py", line 728, in from_file
    info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/pydub/utils.py", line 279, in mediainfo_json
    info = json.loads(output)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)


##############################################################
##############################################################
##############################################################

Logger: custom_components.chime_tts
Bron: custom_components/chime_tts/__init__.py:1051
integratie: Chime TTS (documentatie, problemen)
Eerst voorgekomen: 09:56:54 (1 gebeurtenissen)
Laatst gelogd: 09:56:54

Unable to extract audio from file: "[Errno 2] No such file or directory: 'custom_components/chime_tts/mp3s/bells.mp3'"

Diagnostics dump

No response

@nimroddolev
Copy link
Owner

Hi @bvdkerkhof,

Based on the error it looks like the chime mp3 folder custom_components/chime_tts/mp3s cannot be found. I haven't experienced this issue or had anyone else report it, so I am going to assume it's caused by something specific to your setup.

  • Did you install Chime TTS via the HACS or manually?
  • Can you verify that the /config/custom_components/chime_tts/mp3s folder exists, and has the bells.mp3 file?
  • Have you tried removing it and reinstalling?
  • Do you receive this same error for other chimes in the drop down list?
  • Do you reveive this same error if you use your own MP3 file path? eg:
service: chime_tts.say
data:
  chime_path: https://cdn.pixabay.com/audio/2021/08/04/audio_db6b90f91c.mp3
  message: This is a test
  tts_platform: google_translate
target:
  entity_id: media_player.macbook_air

@bvdkerkhof
Copy link
Author

bvdkerkhof commented Apr 15, 2024

I'm running HA Core and missing the /config/ path. We had this issue in the beginning of Chime addon and there was a fix. Except as the F1 season was started and my announcements didnt play anymore I looked into this today and noticed the errors.

  • Chime is installed by HACS
  • i'm missing the /config/ path, my whole path to the MP3 folder is: /home/homeassistant/.homeassistant/custom_components/chime_tts/mp3s and yes there is the bells.mp3 file located
  • Already tried removing and reinstalling, but this didnt work
  • yes for multiple chimes
  • When running the code provided I only get this error:
Logger: homeassistant.components.websocket_api.http.connection
Bron: custom_components/chime_tts/helpers/filesystem.py:176
integratie: Home Assistant WebSocket API (documentatie, problemen)
Eerst voorgekomen: 14:38:17 (1 gebeurtenissen)
Laatst gelogd: 14:38:17

[1596641000] Error handling message: Unknown error (unknown_error) Bram from 127.0.0.1 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0)
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
    await func(hass, connection, msg)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/websocket_api/commands.py", line 794, in handle_execute_script
    script_result = await script_obj.async_run(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 1713, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 457, in async_run
    await self._async_step(log_exceptions=False)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 509, in _async_step
    self._handle_exception(
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 539, in _handle_exception
    raise exception
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 507, in _async_step
    await getattr(self, handler)()
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 736, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 699, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 116, in async_say
    result = await queue.add_to_queue(async_say_execute, service, is_say_url)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/queue_manager.py", line 33, in async_process_queue
    result = await asyncio.wait_for(
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 138, in async_say_execute
    audio_dict = await async_get_playback_audio_path(params, options)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 751, in async_get_playback_audio_path
    output_audio = await async_get_audio_from_path(hass=hass,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 1004, in async_get_audio_from_path
    filepath = await filesystem_helper.async_get_chime_path(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/helpers/filesystem.py", line 85, in async_get_chime_path
    audio_dict = await self.async_download_file(hass, chime_path, temp_chimes_path)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/helpers/filesystem.py", line 176, in async_download_file
    audio_content = AudioSegment.from_file(BytesIO(response.content),
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/pydub/audio_segment.py", line 728, in from_file
    info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/pydub/utils.py", line 279, in mediainfo_json
    info = json.loads(output)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@nimroddolev
Copy link
Owner

Thank you.

Can you please enable debug logging so I can see what might be causing the issue?

  1. Turn on debug logging:

    service: logger.set_level
    data:
      custom_components.chime_tts: debug
    
  2. Call the chime_tts.say service again.

  3. Check your log messages in Home Assistant:

    https://{YOUR_HOME_ASSISTANT_ADDRESS}:8123/config/logs?filter=chime_tts
    

    and click LOAD FULL LOGS

@bvdkerkhof
Copy link
Author

2024-04-15 14:35:08.206 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
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 116, in async_say
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/queue_manager.py", line 33, in async_process_queue
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 138, in async_say_execute
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 751, in async_get_playback_audio_path
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 1004, in async_get_audio_from_path
filepath = await filesystem_helper.async_get_chime_path(
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/helpers/filesystem.py", line 85, in async_get_chime_path
audio_dict = await self.async_download_file(hass, chime_path, temp_chimes_path)
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/helpers/filesystem.py", line 176, in async_download_file
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 116, in async_say
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/queue_manager.py", line 33, in async_process_queue
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 138, in async_say_execute
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 751, in async_get_playback_audio_path
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 1004, in async_get_audio_from_path
filepath = await filesystem_helper.async_get_chime_path(
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/helpers/filesystem.py", line 85, in async_get_chime_path
audio_dict = await self.async_download_file(hass, chime_path, temp_chimes_path)
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/helpers/filesystem.py", line 176, in async_download_file

@nimroddolev
Copy link
Owner

These are not the debug log messages. Please review my last comment for instructions on enabling debug logs and viewing them in the logs page.

@bvdkerkhof
Copy link
Author

Logger: homeassistant.components.websocket_api.http.connection
Bron: custom_components/chime_tts/helpers/filesystem.py:176
integratie: Home Assistant WebSocket API (documentatie, problemen)
Eerst voorgekomen: 14:38:17 (2 gebeurtenissen)
Laatst gelogd: 14:48:53

[1596641000] Error handling message: Unknown error (unknown_error) Bram from 127.0.0.1 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0)
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
    await func(hass, connection, msg)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/websocket_api/commands.py", line 794, in handle_execute_script
    script_result = await script_obj.async_run(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 1713, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 457, in async_run
    await self._async_step(log_exceptions=False)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 509, in _async_step
    self._handle_exception(
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 539, in _handle_exception
    raise exception
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 507, in _async_step
    await getattr(self, handler)()
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 736, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/script.py", line 699, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 116, in async_say
    result = await queue.add_to_queue(async_say_execute, service, is_say_url)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/queue_manager.py", line 33, in async_process_queue
    result = await asyncio.wait_for(
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 138, in async_say_execute
    audio_dict = await async_get_playback_audio_path(params, options)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 751, in async_get_playback_audio_path
    output_audio = await async_get_audio_from_path(hass=hass,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 1004, in async_get_audio_from_path
    filepath = await filesystem_helper.async_get_chime_path(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/helpers/filesystem.py", line 85, in async_get_chime_path
    audio_dict = await self.async_download_file(hass, chime_path, temp_chimes_path)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/homeassistant/.homeassistant/custom_components/chime_tts/helpers/filesystem.py", line 176, in async_download_file
    audio_content = AudioSegment.from_file(BytesIO(response.content),
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/pydub/audio_segment.py", line 728, in from_file
    info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/homeassistant/lib/python3.12/site-packages/pydub/utils.py", line 279, in mediainfo_json
    info = json.loads(output)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@nimroddolev
Copy link
Owner

Hi @bvdkerkhof, you are still not providing me with the debug log messages.

I feel like something has been lost in translation, let's try this another way:

  1. Go to Settings and then select Devices & services
    1

  2. From the Integrations tab, click on Chime TTS
    2

  3. Click on Enable debug logging
    3

  4. Now, call the chime_tts.say service with debug logging enabled

  5. Go to Settings and then select System
    4

  6. Then select Logs
    5

  7. From the Logs page, enter chime into the search field, and then select LOAD FULL LOGS
    6

@bvdkerkhof
Copy link
Author

2024-04-15 20:26:00.702 WARNING (SyncWorker_2) [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
2024-04-15 20:28:05.152 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Called. Version v1.0.0 -----
2024-04-15 20:28:05.153 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Adding service call to queue
2024-04-15 20:28:05.195 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] ```Media players found: [{'entity_id': 'media_player.kantoor', 'should_change_volume': False, 'initial_volume_level': -1, 'group_members_supported': False, 'announce_supported': False, 'resume_media_player': False}]
2024-04-15 20:28:05.196 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ----- General Parameters -----
2024-04-15 20:28:05.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * entity_ids = ['media_player.kantoor']
2024-04-15 20:28:05.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * chime_path = https://cdn.pixabay.com/audio/2021/08/04/audio_db6b90f91c.mp3
2024-04-15 20:28:05.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * cache = False
2024-04-15 20:28:05.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * offset = 450.0
2024-04-15 20:28:05.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * final_delay = 0.0
2024-04-15 20:28:05.197 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * message = This is a test
2024-04-15 20:28:05.198 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * tts_platform = google_translate
2024-04-15 20:28:05.198 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * tts_speed = 100.0
2024-04-15 20:28:05.198 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * tts_pitch = 0
2024-04-15 20:28:05.198 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * announce = False
2024-04-15 20:28:05.198 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * volume_level = -1.0
2024-04-15 20:28:05.198 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * join_players = False
2024-04-15 20:28:05.198 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * unjoin_players = False
2024-04-15 20:28:05.200 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem] Downloading chime at URL: https://cdn.pixabay.com/audio/2021/08/04/audio_db6b90f91c.mp3
2024-04-15 20:28:05.595 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem] - Audio downloaded successfully
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 116, in async_say
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/queue_manager.py", line 33, in async_process_queue
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 138, in async_say_execute
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 751, in async_get_playback_audio_path
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 1004, in async_get_audio_from_path
filepath = await filesystem_helper.async_get_chime_path(
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/helpers/filesystem.py", line 85, in async_get_chime_path
audio_dict = await self.async_download_file(hass, chime_path, temp_chimes_path)
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/helpers/filesystem.py", line 176, in async_download_file
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 116, in async_say
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/queue_manager.py", line 33, in async_process_queue
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 138, in async_say_execute
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 751, in async_get_playback_audio_path
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/__init__.py", line 1004, in async_get_audio_from_path
filepath = await filesystem_helper.async_get_chime_path(
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/helpers/filesystem.py", line 85, in async_get_chime_path
audio_dict = await self.async_download_file(hass, chime_path, temp_chimes_path)
File "/home/homeassistant/.homeassistant/custom_components/chime_tts/helpers/filesystem.py", line 176, in async_download_file

@nimroddolev
Copy link
Owner

I will investigate further tomorrow. Could you please also check what folder paths you have configured in the integration’s configuration page?

Settings —> Integrations —> Chime TTS —> CONFIGURE

@nimroddolev nimroddolev added the bug Something isn't working label Apr 16, 2024
@bvdkerkhof
Copy link
Author

I have checked the paths and they are also available on the filesystem / created.

@nimroddolev
Copy link
Owner

Thank you. After reviewing your debug logs I can now see that the issue occurs when trying to load audio to an AudioSegment with pydub.

Seeing as Chime TTS has worked for you in the past I believe the issue remains due to an incorrect file path.

Can you please share with me your folder paths in your configuration?

Settings —> Integrations —> Chime TTS —> CONFIGURE

@bvdkerkhof
Copy link
Author

Thank you for investigating. Below the paths:

Folder path to store downloaded chime audio files
/home/homeassistant/.homeassistant/media/sounds/temp/chime_tts/chimes/

Folder path to store temporary TTS audio mp3 files
/home/homeassistant/.homeassistant/media/sounds/temp/chime_tts/

Folder path to generated chime tts files (by the service)
/home/homeassistant/.homeassistant/www/chime_tts/

@nimroddolev
Copy link
Owner

I don't see a problem with the folder paths in your configuration.

With debug logging enabled, can you please reload the configuration (Settings --> Devices & services --> Chime TTS --> --> ↻ Reload) and let me know what the debug log output was?

@bvdkerkhof
Copy link
Author

2024-04-19 13:48:36.556 WARNING (SyncWorker_0) [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
2024-04-19 13:52:32.413 DEBUG (MainThread) [custom_components.chime_tts] Chime TTS Configuration Values:
2024-04-19 13:52:32.413 DEBUG (MainThread) [custom_components.chime_tts] - queue_timeout: 60
2024-04-19 13:52:32.413 DEBUG (MainThread) [custom_components.chime_tts] - tts_platform_key: 'google_translate'
2024-04-19 13:52:32.414 DEBUG (MainThread) [custom_components.chime_tts] - offset: 450
2024-04-19 13:52:32.414 DEBUG (MainThread) [custom_components.chime_tts] - temp_chimes_path: '/home/homeassistant/.homeassistant/media/sounds/temp/chime_tts/chimes/'
2024-04-19 13:52:32.414 DEBUG (MainThread) [custom_components.chime_tts] - temp_path: '/home/homeassistant/.homeassistant/media/sounds/temp/chime_tts/'
2024-04-19 13:52:32.414 DEBUG (MainThread) [custom_components.chime_tts] - www_path: '/home/homeassistant/.homeassistant/www/chime_tts/'
2024-04-19 13:52:32.415 DEBUG (MainThread) [custom_components.chime_tts] - media_dir: 'local'
2024-04-19 13:52:32.415 DEBUG (MainThread) [custom_components.chime_tts] - custom_paths:
2024-04-19 13:52:32.415 DEBUG (MainThread) [custom_components.chime_tts] - custom_chime_path_1:
2024-04-19 13:52:32.415 DEBUG (MainThread) [custom_components.chime_tts] - custom_chime_path_2:
2024-04-19 13:52:32.416 DEBUG (MainThread) [custom_components.chime_tts] - custom_chime_path_3:
2024-04-19 13:52:32.416 DEBUG (MainThread) [custom_components.chime_tts] - custom_chime_path_4:
2024-04-19 13:52:32.416 DEBUG (MainThread) [custom_components.chime_tts] - custom_chime_path_5:

@nimroddolev
Copy link
Owner

nimroddolev commented May 9, 2024

Hi @bvdkerkhof,

I have released a new beta version, v1.1.0-beta5, which I believe may address the issue. Can you please upgrade to the new version and let me know if the issue is resolved?

To install the new beta version:

  1. Open the Chime TTS repository in HACS
  2. Click on the button in the top right
  3. Select the ↻ Redownload option
  4. Enable the Show beta versions option (it may take a moment to update the list)
  5. Select version v1.1.0-beta5 from the updated version drop-down list
  6. Restart Home Assistant

@bvdkerkhof
Copy link
Author

Hi @nimroddolev

Thank you for the beta, i have to check if I can test it as i have also (yesterday on ascension) migrated my setup to HAOS on a NUC instead of the Pi with a VENV on Python 3.12.

I'll get back to you asap.

@nimroddolev
Copy link
Owner

HI @bvdkerkhof, have tested whether this issue is resolved?

@nimroddolev
Copy link
Owner

nimroddolev commented Jun 19, 2024

Hi @bvdkerkhof. Can you please upgrade to the latest stable release and let me know if the issue is resolved for you?

@nimroddolev
Copy link
Owner

I am closing this issue. If you still encounter this issue on the latest stable release, please open a new issue and supply debug logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants