Playing announcements with TTS on Sonos S1 refuses TTS (chime is playing)

Hi,

I managed to configure Chime TTS for Sonos S1. The playlist stops and restarts after the announcement without issue.

alias: Ring Doors
description: ""
trigger:
  - type: opened
    platform: device
    device_id: a9fd66655ffb6683c93260d7b8b60a29
    entity_id: 5946a19aa98733dafd1b80922398d271
    domain: binary_sensor
condition: []
action:
  - service: sonos.snapshot
    metadata: {}
    data:
      with_group: true
      entity_id: media_player.sonos_master_bedroom
    enabled: true
  - service: chime_tts.say
    data:
      tts_platform: google_translate
      message: Hello world
      gender: female
      tld: com
      language: en
      chime_path: ding_dong
      tts_speed: 100
      tts_pitch: 0
      volume_level: 0.4
    target:
      device_id: 0c02ced3577aff8f328984a2f96d20e7
  - service: sonos.restore
    metadata: {}
    data:
      with_group: true
      entity_id: media_player.sonos_master_bedroom
    enabled: true
mode: parallel
max: 10

However the TTS feature does not work (I installed Google Translate TTS for en on fr and com tld)

Hi @LeoG. It would be helpful to have your debug log messages to better understand what’s happening when Chime TTS is trying to generate the TTS audio.

To enable debug logs:

  1. Turn on debug logging for Chime TTS:

    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

2024-05-20 08:23:10.896 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Called. Version v1.0.0 -----
2024-05-20 08:23:10.896 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Adding service call to queue
2024-05-20 08:23:10.900 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] ```Media players found: [{'entity_id': 'media_player.sonos_living_room', 'should_change_volume': True, 'initial_volume_level': 0.18, 'group_members_supported': True, 'announce_supported': True, 'resume_media_player': False}]
2024-05-20 08:23:10.900 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ----- General Parameters -----
2024-05-20 08:23:10.900 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * entity_ids = ['media_player.sonos_living_room']
2024-05-20 08:23:10.900 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * chime_path = ding_dong
2024-05-20 08:23:10.900 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * cache = False
2024-05-20 08:23:10.900 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * offset = 450.0
2024-05-20 08:23:10.900 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * final_delay = 0.0
2024-05-20 08:23:10.900 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * message = Hello world
2024-05-20 08:23:10.901 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * language = en
2024-05-20 08:23:10.901 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * tts_platform = google_translate
2024-05-20 08:23:10.901 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * tts_speed = 100.0
2024-05-20 08:23:10.901 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * tts_pitch = 0
2024-05-20 08:23:10.901 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * announce = False
2024-05-20 08:23:10.901 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * volume_level = 0.4
2024-05-20 08:23:10.901 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * join_players = False
2024-05-20 08:23:10.901 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * unjoin_players = False
2024-05-20 08:23:10.901 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ----- TTS-Specific Params -----
2024-05-20 08:23:10.901 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * tld = fr
2024-05-20 08:23:10.901 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * gender = female
2024-05-20 08:23:10.902 DEBUG (MainThread) [custom_components.chime_tts] - Retrieving audio from path: "custom_components/chime_tts/mp3s/ding_dong.mp3"...
2024-05-20 08:23:11.163 DEBUG (MainThread) [custom_components.chime_tts] ...audio retrieved. Duration: 1.533s
2024-05-20 08:23:11.163 DEBUG (MainThread) [custom_components.chime_tts] - Generating new TTS audio with parameters:
2024-05-20 08:23:11.164 DEBUG (MainThread) [custom_components.chime_tts] * tts_platform = 'google_translate'
2024-05-20 08:23:11.164 DEBUG (MainThread) [custom_components.chime_tts] * message = 'Hello world'
2024-05-20 08:23:11.164 DEBUG (MainThread) [custom_components.chime_tts] * cache = False
2024-05-20 08:23:11.164 DEBUG (MainThread) [custom_components.chime_tts] * language = "en"
2024-05-20 08:23:11.164 DEBUG (MainThread) [custom_components.chime_tts] * options = {'tld': 'fr'}
2024-05-20 08:23:11.164 ERROR (MainThread) [custom_components.chime_tts] The google_translate platform was not found. Please check that it has been configured correctly: https://www.home-assistant.io/integrations/#text-to-speech
2024-05-20 08:23:11.164 WARNING (MainThread) [custom_components.chime_tts] Error generating TTS audio from messsage segment #1: {'type': 'tts', 'message': 'Hello world'}
2024-05-20 08:23:11.164 DEBUG (MainThread) [custom_components.chime_tts] - Saving mp3 file to folder: /media/sounds/temp/chime_tts/...
2024-05-20 08:23:11.396 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem] - File saved to path: /media/sounds/temp/chime_tts/anvqufrq.mp3
2024-05-20 08:23:11.650 DEBUG (MainThread) [custom_components.chime_tts] - Chime TTS audio generated:
2024-05-20 08:23:11.650 DEBUG (MainThread) [custom_components.chime_tts] - audio_duration = 1.533
2024-05-20 08:23:11.650 DEBUG (MainThread) [custom_components.chime_tts] - local_path = "/media/sounds/temp/chime_tts/anvqufrq.mp3"
2024-05-20 08:23:11.650 DEBUG (MainThread) [custom_components.chime_tts] - public_path = None
2024-05-20 08:23:11.650 DEBUG (MainThread) [custom_components.chime_tts] - media_content_id = "media-source://media_source/local/sounds/temp/chime_tts/anvqufrq.mp3"

The google_translate platform was not found.

How comes?

EDIT: @Nimrod_Dolev I see nothing else related to Google Translate TTS in the logs apart from what is generated by chime_tts

Thank you for the debug logs.

I think the issue is that you’re trying to use language-specific Google Translate (tts.google_en_com & tts.google_en.fr) instead of the general Google Translate integration (which supports all languages).

You can add it via your configuation.yaml file:

tts:
  - platform: google_translate
    service_name: google_say

After adding it, restart your Home Assistant and it should start working for you.

Thanks @Nimrod_Dolev

I doubt it a little since chime_tts provides the option of changing language and tld > I’d then guess that if this specific language and tld are installed, it does the job.

My config.yaml before

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

after

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

tts:
  - platform: google_translate
    service_name: google_say

verified that configuration.yaml is updated at

~$ sudo nano /home/[USER]/hass-config/configuration.yaml

restarted HA

issue remains similar > how can I verify that the path to configuration.yaml is the right one?

Logs after using chime_tts once again:

It’s strange that the Google Translate platform still isn’t found after adding it to your configuration.yaml file.

Perhaps try calling the tts.google_say service directly to test whether it’s working to begin with:

service: tts.google_say
data:
  message: This is a test
  entity_id: media_player.browser

Another thing may be of consequence: I read up on chime_tts, and saw that it waits for the tts in order to combine it with the chime. normal tts messages take time and afaik does not wait for it to finish. So the restoring action straight after the tts may cancel the text. try removing it or putting in a long delay.

Thanks @Nimrod_Dolev @Edwin_D

I moved to TTS only in order to remove chime_tts from the equation

I renamed my Google translate TTS service to tts.speak based on this post by @MattiasPie

action:
  - service: sonos.snapshot
    metadata: {}
    data:
      with_group: true
      entity_id: media_player.sonos_living_room
    enabled: true
  - service: tts.speak
    data:
      cache: false
      media_player_entity_id: media_player.sonos_living_room
      message: Hello Marta!
      language: en
    target:
      entity_id: tts.speak
  - service: sonos.restore
    metadata: {}
    data:
      with_group: true
      entity_id: media_player.sonos_living_room
    enabled: true
mode: parallel
max: 10

If I don’t select an entity, my music does not stop playing.
If I select an entity IE tts.speak, my music stops playing and the gap seems to last the time of the TTS. Only problem: no sound!

Quite a problem for TTS :innocent:

EDIT: Logs remain empty…

EDIT2: The duration of the pause in my music (about 4s) does not depends of the length of the text. So this does not seem to be a TTS sound volume issue for example…

Same problem here !

I tried everything but since a couple of days no announcements are working anymore.
I think something is broken after the last update from 17th of May.

To test I go to Media / Text-to-speech / selecting one of the options Cloud, Google, Home assistant or Piper than select the right media player on the bottom and let them speak…
The test is not working on my Sonos Move, it works only when I select the Browser !

Also Chime is not working anymore.

I will wait for the next update…

Regards, Benny