nimroddolev / chime_tts

A custom Home Assistant integration to play combined audio files before and/or after text-to-speech (TTS) messages
https://nimroddolev.github.io/chime_tts/
MIT License
196 stars 14 forks source link

doesn't play anything #139

Closed 1mfaasj closed 5 months ago

1mfaasj commented 5 months ago

System Health details

option is not available in my version of Home Assistant (docker)

but I use these versions now:

Checklist

Describe the issue

Chime doesn't play or say anything. I've tried almost everything to make it work so I hope you guys have a solution.

docker compose:

version: "3.4"
services:
  homeassistant:
    image: ghcr.io/home-assistant/home-assistant:2024.5
    network_mode: host
    volumes:
      - /share/docker/compose/appdata/hass:/config
      - /share/backup/hass:/backup
    environment:
      - DISABLE_JEMALLOC=true
    restart: always

Home Assistant configuration.yaml

homeassistant:
  packages: !include_dir_named packages
  media_dirs:
    media: "/backup"
    local: /backup
  allowlist_external_dirs:
    - "/backup"

chime config: image

Reproduction steps

fails when I use this automation:

service: chime_tts.say
metadata: {}
data:
  end_chime_path: ba_dum_tss
  offset: 450
  final_delay: 0
  tts_speed: 316
  tts_pitch: 0
  volume_level: 0.29
  message: hello
  tts_platform: tts.google_nl_com
  chime_path: bells
  cache: false
target:
  entity_id: media_player.woonkamer

In Home assistant Services, it fails too: image

This also fails: image

Debug logs

2024-06-01 09:35:21.688 WARNING (MainThread) [custom_components.chime_tts] Error calling `media_player.play_media` service: No media content id found
2024-06-01 09:36:47.468 ERROR (SyncWorker_37) [homeassistant] Error doing job: Task was destroyed but it is pending!
2024-06-01 09:36:47.468 ERROR (SyncWorker_37) [homeassistant] Error doing job: Task was destroyed but it is pending!
2024-06-01 09:36:48.323 WARNING (Thread-18) [pychromecast.socket_client] [Woonkamer(192.168.2.170):8009] Heartbeat timeout, resetting connection
2024-06-01 09:37:04.060 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Adding service call to queue
2024-06-01 09:37:04.060 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Called. Version v1.1.0-beta8 -----
2024-06-01 09:37:04.060 INFO (MainThread) [custom_components.chime_tts.helpers.media_player] Turning on "media_player.woonkamer"...
2024-06-01 09:37:04.062 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ----- General Parameters -----
2024-06-01 09:37:04.062 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * entity_ids = ['media_player.woonkamer']
2024-06-01 09:37:04.062 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * chime_path = bells
2024-06-01 09:37:04.062 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * end_chime_path = ba_dum_tss
2024-06-01 09:37:04.062 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * cache = False
2024-06-01 09:37:04.062 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * offset = 450.0
2024-06-01 09:37:04.062 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * final_delay = 0.0
2024-06-01 09:37:04.062 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * message = halloooooooooooooo
2024-06-01 09:37:04.062 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_platform = tts.google_nl_com
2024-06-01 09:37:04.062 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_speed = 316.0
2024-06-01 09:37:04.063 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_pitch = 0
2024-06-01 09:37:04.063 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * announce = False
2024-06-01 09:37:04.063 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * fade_audio = False
2024-06-01 09:37:04.063 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * volume_level = 0.29
2024-06-01 09:37:04.063 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * join_players = False
2024-06-01 09:37:04.063 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * unjoin_players = False
2024-06-01 09:37:04.063 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * media_players_array:
2024-06-01 09:37:04.063 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - entity_id: media_player.woonkamer
2024-06-01 09:37:04.063 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      platform: cast
2024-06-01 09:37:04.063 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      initial volume: -1.0
2024-06-01 09:37:04.063 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      target volume: 0.29
2024-06-01 09:37:04.063 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      now playing: False
2024-06-01 09:37:04.063 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      join supported: False
2024-06-01 09:37:04.063 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]      announce supported: False
2024-06-01 09:37:04.080 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem] Local path to chime: /config/custom_components/chime_tts/mp3s/bells.mp3
2024-06-01 09:37:04.081 DEBUG (MainThread) [custom_components.chime_tts]  - Retrieving audio from path: "/config/custom_components/chime_tts/mp3s/bells.mp3"...
2024-06-01 09:37:06.698 DEBUG (MainThread) [custom_components.chime_tts]    ...audio retrieved. Duration: 0.944s
2024-06-01 09:37:06.698 DEBUG (MainThread) [custom_components.chime_tts]  - Generating new TTS audio with parameters:
2024-06-01 09:37:06.698 DEBUG (MainThread) [custom_components.chime_tts]     * tts_platform = 'tts.google_nl_com'
2024-06-01 09:37:06.698 DEBUG (MainThread) [custom_components.chime_tts]     * message = 'halloooooooooooooo'
2024-06-01 09:37:06.698 DEBUG (MainThread) [custom_components.chime_tts]     * cache = False
2024-06-01 09:37:06.698 DEBUG (MainThread) [custom_components.chime_tts]     * language = None
2024-06-01 09:37:06.699 DEBUG (MainThread) [custom_components.chime_tts]     * options = {}
2024-06-01 09:37:06.953 DEBUG (MainThread) [custom_components.chime_tts]    ...TTS audio generated in 260.0ms
2024-06-01 09:37:06.954 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  -  ...changing TTS playback speed to 316.0% of original
2024-06-01 09:37:07.126 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem] File saved to path: /backup/tunes/temp/chime_tts/temp_segment.mp3
2024-06-01 09:37:07.126 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] Converting audio: "ffmpeg -i /backup/tunes/temp/chime_tts/temp_segment.mp3 -af atempo=3.16 /backup/tunes/temp/chime_tts/temp_segment_converted.mp3"
2024-06-01 09:37:07.377 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem] Local path to chime: /config/custom_components/chime_tts/mp3s/ba_dum_tss.mp3
2024-06-01 09:37:07.377 DEBUG (MainThread) [custom_components.chime_tts]  - Retrieving audio from path: "/config/custom_components/chime_tts/mp3s/ba_dum_tss.mp3"...
2024-06-01 09:37:07.533 DEBUG (MainThread) [custom_components.chime_tts]    ...audio retrieved. Duration: 2.403s
2024-06-01 09:37:07.545 DEBUG (MainThread) [custom_components.chime_tts]  - Saving mp3 file to folder: /backup/tunes/temp/chime_tts/...
2024-06-01 09:37:07.952 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem] File saved to path: /backup/tunes/temp/chime_tts/z3hltc74.mp3
2024-06-01 09:37:08.114 DEBUG (MainThread) [custom_components.chime_tts]  - Chime TTS audio generated:
2024-06-01 09:37:08.114 DEBUG (MainThread) [custom_components.chime_tts]    * audio_duration = 4.572
2024-06-01 09:37:08.114 DEBUG (MainThread) [custom_components.chime_tts]    * local_path = "/backup/tunes/temp/chime_tts/z3hltc74.mp3"
2024-06-01 09:37:08.114 DEBUG (MainThread) [custom_components.chime_tts]    * public_path = None
2024-06-01 09:37:08.114 DEBUG (MainThread) [custom_components.chime_tts]    * media_content_id = None
2024-06-01 09:37:08.114 DEBUG (MainThread) [custom_components.chime_tts]  *** Pre-Playback Actions *** 
2024-06-01 09:37:08.114 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] Increasing media_player.woonkamer's volume from -1.0 to 0.29
2024-06-01 09:37:08.114 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] Calling media_player.volume_set with data:
2024-06-01 09:37:08.114 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper]  - volume_level: 0.29
2024-06-01 09:37:08.114 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper]  - entity_id: media_player.woonkamer
2024-06-01 09:37:09.125 DEBUG (MainThread) [custom_components.chime_tts]  *** Chime TTS playback ***
2024-06-01 09:37:09.125 WARNING (MainThread) [custom_components.chime_tts] Error calling `media_player.play_media` service: No media content id found
2024-06-01 09:37:09.125 DEBUG (MainThread) [custom_components.chime_tts]  - Waiting 4.572s for audio playback to complete...
2024-06-01 09:37:13.698 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper]  - Waiting until 1 media_player isn't playing...
2024-06-01 09:37:13.698 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper]    ✔ media_player.woonkamer
2024-06-01 09:37:14.001 DEBUG (MainThread) [custom_components.chime_tts]  *** Post-Playback Actions ***
2024-06-01 09:37:14.001 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] Increasing media_player.woonkamer's volume from 0.28999999165534973 to 0.29
2024-06-01 09:37:14.001 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper] Calling media_player.volume_set with data:
2024-06-01 09:37:14.002 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper]  - volume_level: 0.29
2024-06-01 09:37:14.002 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player_helper]  - entity_id: media_player.woonkamer
2024-06-01 09:37:15.012 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Completed in 10.95 s -----

Diagnostics dump

this option isn't available in my version of Home Assistant (docker)

nimroddolev commented 5 months ago

Hi @1mfaasj. I think the issue is that you have configured the temporary folder which stores the generated MP3s, outside of your home Assistance media folder (which means that these files cannot be played). I suggest you try changing the path from /backup/… to a path under /media/…

Edit: Sorry - I overlooked that you do have the /backup folder included in your list of media_dirs section of your configuration.yaml file. I will take further look into this issue.

Could you please test whether the issue still occurs if you change the temporary folder path to /media/temp?

nimroddolev commented 5 months ago

@1mfaasj I am closing this issue but please reopen it with more information if you are still experiencing the issue