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

Thankyou @Nimrod_Dolev, I also really like this integration. I was listening to a podcast the other day on alarm design, and this is exactly what they said. Use a chime to get people’s attention, then something to indicate the specific alert - in this case it’s TTS but it could also be a particular sound effect that has meaning. Bad alarm design uses all sorts of horrible beeps and alarms with no meaning that we we have to learn or investigate what they’re for.

However, I’m having a couple of issues with version 1.0.0.

  1. Cache doesn’t work for me, it throws an Unknown Error. I’m using a rPi4 with HASSOS.

  2. Announce at 100% volume when music is currently playing. The Announce feature increases the volume first, plays the chime and TTS, then returns to the volume back normal. e.g. if the music is at 15% and the announce is at 100%, then the result is music is playing at 15%, submit the chime_tts → music plays at 100% for 1 second, chime_tts announcement at 100%, music continues playing 100% for another 1 second, then music volume returns to 15%.

Hi, new here. Using 1.1.0 Beta 4. On Sonos paired setup

Since using the Beta 4, the recording is playing twice and only out of 1 speaker
Removing this audio_conversion: “-filter:a volume=1.5” stops the repeating but still only out of 1 speaker. Apologies if a known issue, let me know if logs would be useful.

Current automation.

data:
  chime_path: bells
  message: The alarm is now set.
  tts_platform: tts.piper
  announce: true
  audio_conversion: "-filter:a volume=1.5"
target:
  entity_id:
    - media_player.kitchen_sonos```

Can’t seem to get any audio output either testing via the call service below with v1.0.0.

service: chime_tts.say
data:
  chime_path: custom_components/chime_tts/mp3s/bells.mp3
  end_chime_path: custom_components/chime_tts/mp3s/tada.mp3
  message: This is a test message using Chime TTS.
  tts_platform: cloud
  volume_level: 0.75
  announce: true
target:
  entity_id: media_player.living_room

Debug Log

2024-05-05 09:35:38.762 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Called. Version v1.0.0 -----
2024-05-05 09:35:38.763 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Adding service call to queue
2024-05-05 09:35:38.764 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] ```Media players found: [{'entity_id': 'media_player.living_room', 'should_change_volume': True, 'initial_volume_level': 0.5, 'group_members_supported': True, 'announce_supported': True, 'resume_media_player': False}]
2024-05-05 09:35:38.765 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ----- General Parameters -----
2024-05-05 09:35:38.765 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * entity_ids = ['media_player.living_room']
2024-05-05 09:35:38.765 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * chime_path = custom_components/chime_tts/mp3s/bells.mp3
2024-05-05 09:35:38.766 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * end_chime_path = custom_components/chime_tts/mp3s/tada.mp3
2024-05-05 09:35:38.776 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * cache = False
2024-05-05 09:35:38.777 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * offset = 450.0
2024-05-05 09:35:38.777 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * final_delay = 0.0
2024-05-05 09:35:38.777 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * message = This is a test message using Chime TTS.
2024-05-05 09:35:38.777 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_platform = cloud
2024-05-05 09:35:38.777 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_speed = 100.0
2024-05-05 09:35:38.778 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_pitch = 0
2024-05-05 09:35:38.778 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * announce = True
2024-05-05 09:35:38.778 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * volume_level = 0.75
2024-05-05 09:35:38.778 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * join_players = False
2024-05-05 09:35:38.778 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * unjoin_players = False
2024-05-05 09:35:38.780 DEBUG (MainThread) [custom_components.chime_tts]  - Retrieving audio from path: "custom_components/chime_tts/mp3s/bells.mp3"...
2024-05-05 09:35:39.080 DEBUG (MainThread) [custom_components.chime_tts]    ...audio retrieved. Duration: 0.944s
2024-05-05 09:35:39.081 DEBUG (MainThread) [custom_components.chime_tts]  - Generating new TTS audio with parameters:
2024-05-05 09:35:39.082 DEBUG (MainThread) [custom_components.chime_tts]     * tts_platform = 'cloud'
2024-05-05 09:35:39.082 DEBUG (MainThread) [custom_components.chime_tts]     * message = 'This is a test message using Chime TTS.'
2024-05-05 09:35:39.082 DEBUG (MainThread) [custom_components.chime_tts]     * cache = False
2024-05-05 09:35:39.082 DEBUG (MainThread) [custom_components.chime_tts]     * language = None
2024-05-05 09:35:39.082 DEBUG (MainThread) [custom_components.chime_tts]     * options = {}
2024-05-05 09:35:39.956 DEBUG (MainThread) [custom_components.chime_tts]    ...TTS audio generated in 870.0ms
2024-05-05 09:35:39.968 DEBUG (MainThread) [custom_components.chime_tts]  - Retrieving audio from path: "custom_components/chime_tts/mp3s/tada.mp3"...
2024-05-05 09:35:40.281 DEBUG (MainThread) [custom_components.chime_tts]    ...audio retrieved. Duration: 2.323s
2024-05-05 09:35:40.317 DEBUG (MainThread) [custom_components.chime_tts]  - Saving mp3 file to folder: /config/tts/...
2024-05-05 09:35:40.907 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem]  - File saved to path: /config/tts/q8ldpbux.mp3
2024-05-05 09:35:41.243 DEBUG (MainThread) [custom_components.chime_tts]  - Chime TTS audio generated:
2024-05-05 09:35:41.243 DEBUG (MainThread) [custom_components.chime_tts]    - audio_duration = 7.646
2024-05-05 09:35:41.243 DEBUG (MainThread) [custom_components.chime_tts]    - local_path = "/config/tts/q8ldpbux.mp3"
2024-05-05 09:35:41.244 DEBUG (MainThread) [custom_components.chime_tts]    - public_path = None
2024-05-05 09:35:41.244 DEBUG (MainThread) [custom_components.chime_tts]    - media_content_id = None
2024-05-05 09:35:41.244 DEBUG (MainThread) [custom_components.chime_tts]  *** Pre-Playback Actions *** 
2024-05-05 09:35:41.244 DEBUG (MainThread) [custom_components.chime_tts]  - Setting volume level to 0.75 for 1 non-fade in/out media_player
2024-05-05 09:35:41.244 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]  - Setting media_player.living_room's volume to 0.75
2024-05-05 09:35:41.483 DEBUG (MainThread) [custom_components.chime_tts]  *** Chime TTS playback ***
2024-05-05 09:35:41.483 WARNING (MainThread) [custom_components.chime_tts] Error calling `media_player.play_media` service: No media content id found
2024-05-05 09:35:41.483 DEBUG (MainThread) [custom_components.chime_tts]  - Waiting 7.646s for audio playback to complete...
2024-05-05 09:35:46.243 ERROR (Thread-15 (_thread_main)) [tuya_sharing] on message error = 115
2024-05-05 09:35:49.223 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]  - Waiting until 1 media_player isn't playing...
2024-05-05 09:35:49.223 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]    ✔ media_player.living_room
2024-05-05 09:35:49.223 DEBUG (MainThread) [custom_components.chime_tts]  *** Post-Playback Actions ***
2024-05-05 09:35:49.223 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]  - Setting media_player.living_room's volume to 0.5
2024-05-05 09:35:49.253 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Completed in 10.49 s -----

@Coolie1101 and @stormshaker I would suggest updating to the latest BETA version (v1.1.0-beta4) as you will have better success with it as there have been quite a few updates made.

To install the new beta version:

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

Updated to the latest BETA version (v1.1.0-beta4) but the results is still the same.

Most Relevant Debug Log Entry

2024-05-06 10:21:53.948 WARNING (MainThread) [custom_components.chime_tts] Error calling `media_player.play_media` service: **No media content id found**

Full Febug Log

2024-05-06 10:21:51.664 DEBUG (MainThread) [custom_components.chime_tts]     * cache = False
> 2024-05-06 10:21:51.664 DEBUG (MainThread) [custom_components.chime_tts]     * language = None
> 2024-05-06 10:21:51.664 DEBUG (MainThread) [custom_components.chime_tts]     * options = {}
> 2024-05-06 10:21:52.596 DEBUG (MainThread) [custom_components.chime_tts]    ...TTS audio generated in 930.0ms
> 2024-05-06 10:21:52.607 DEBUG (MainThread) [custom_components.chime_tts]  - Retrieving audio from path: "custom_components/chime_tts/mp3s/tada.mp3"...
> 2024-05-06 10:21:52.933 DEBUG (MainThread) [custom_components.chime_tts]    ...audio retrieved. Duration: 2.323s
> 2024-05-06 10:21:52.973 DEBUG (MainThread) [custom_components.chime_tts]  - Saving mp3 file to folder: /config/tts/...
> 2024-05-06 10:21:53.584 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem]  - File saved to path: /config/tts/zu1ev9ay.mp3
> 2024-05-06 10:21:53.945 DEBUG (MainThread) [custom_components.chime_tts]  - Chime TTS audio generated:
> 2024-05-06 10:21:53.946 DEBUG (MainThread) [custom_components.chime_tts]    - audio_duration = 7.646
> 2024-05-06 10:21:53.946 DEBUG (MainThread) [custom_components.chime_tts]    - local_path = "/config/tts/zu1ev9ay.mp3"
> 2024-05-06 10:21:53.946 DEBUG (MainThread) [custom_components.chime_tts]    - public_path = None
> 2024-05-06 10:21:53.946 DEBUG (MainThread) [custom_components.chime_tts]    - media_content_id = None
> 2024-05-06 10:21:53.947 DEBUG (MainThread) [custom_components.chime_tts]  *** Pre-Playback Actions *** 
> 2024-05-06 10:21:53.947 DEBUG (MainThread) [custom_components.chime_tts]  *** Chime TTS playback ***
> 2024-05-06 10:21:53.948 WARNING (MainThread) [custom_components.chime_tts] Error calling `media_player.play_media` service: No media content id found
> 2024-05-06 10:21:53.948 DEBUG (MainThread) [custom_components.chime_tts]  - Waiting 7.646s for audio playback to complete...
> 2024-05-06 10:22:01.599 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]  - Waiting until 1 media_player isn't playing...
> 2024-05-06 10:22:01.599 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]    ✔ media_player.living_room
> 2024-05-06 10:22:01.601 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Completed in 10.24 s -----

@Coolie1101 Your YAML works for me as designed! I would double check your folder setup for allowlist_external_dirs

service: chime_tts.say
data:
  chime_path: custom_components/chime_tts/mp3s/bells.mp3
  end_chime_path: custom_components/chime_tts/mp3s/tada.mp3
  message: This is a test message using Chime TTS.
  tts_platform: cloud
  volume_level: 0.6
  announce: true
target:
  entity_id: media_player.couch_echo_left_amz

Tried without the chime as well, but got the same result.

service: chime_tts.say
data:
  message: This is a test message using Chime TTS.
  tts_platform: cloud
  volume_level: 0.6
target:
  entity_id: media_player.living_room

Allow List Config

homeassistant: 
  packages: !include_dir_named packages
  customize: !include customize.yaml
  allowlist_external_dirs:
    - /config/tts

Chime TTS Config
image

Shows file created, but I don’t see the file in the folder, is it auto deleted on completion?

Most Relevant Debug Log Entry

2024-05-06 13:34:54.341 DEBUG (MainThread) [custom_components.chime_tts]  - Generating new TTS audio with parameters:
2024-05-06 13:34:54.341 DEBUG (MainThread) [custom_components.chime_tts]     * tts_platform = 'cloud'
2024-05-06 13:34:54.341 DEBUG (MainThread) [custom_components.chime_tts]     * message = 'This is a test message using Chime TTS.'
2024-05-06 13:34:54.341 DEBUG (MainThread) [custom_components.chime_tts]     * cache = False
2024-05-06 13:34:54.341 DEBUG (MainThread) [custom_components.chime_tts]     * language = None
2024-05-06 13:34:54.341 DEBUG (MainThread) [custom_components.chime_tts]     * options = {}
2024-05-06 13:34:55.110 DEBUG (MainThread) [custom_components.chime_tts]    ...TTS audio generated in 770.0ms
2024-05-06 13:34:55.110 DEBUG (MainThread) [custom_components.chime_tts]  - Saving mp3 file to folder: /config/tts/...
2024-05-06 13:34:55.396 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem]  - File saved to path: /config/tts/qkoi4a5_.mp3
2024-05-06 13:34:55.734 DEBUG (MainThread) [custom_components.chime_tts]  - Chime TTS audio generated:
2024-05-06 13:34:55.734 DEBUG (MainThread) [custom_components.chime_tts]    - audio_duration = 3.48
2024-05-06 13:34:55.735 DEBUG (MainThread) [custom_components.chime_tts]    - local_path = "/config/tts/qkoi4a5_.mp3"
2024-05-06 13:34:55.735 DEBUG (MainThread) [custom_components.chime_tts]    - public_path = None
2024-05-06 13:34:55.735 DEBUG (MainThread) [custom_components.chime_tts]    - media_content_id = None

HA Log Entry

This error originated from a custom integration.

Logger: custom_components.chime_tts
Source: custom_components/chime_tts/__init__.py:1150
integration: Chime TTS (documentation, issues)
First occurred: 10:21:53 AM (3 occurrences)
Last logged: 1:34:55 PM

Error calling `media_player.play_media` service: No media content id found

Does the media player work after calling the service?

service: tts.speak
target:
  entity_id: tts.home_assistant_cloud
data:
  cache: false
  media_player_entity_id: media_player.living_room
  message: test test test

Yes it does, it works with my existing script as well, just trying to move away from the script, as chime tts is a much cleaner implementation.

I believe the two folders need to be separate You can’t combine them into one. One should be a temporary folder and then the other one should be your output folder

No luck
image

This is my setup which works fine
chime

Heres my setup which works fine:

UuuuuuuuuUntitled

And I have this for my public folders in my configuration file:

homeassistant:
  allowlist_external_dirs:
    - "/config/www/tmp"
    - "/media"
    - "/config/www/chime_tts"

Hi Michael, sorry you’ve been having this issue.

Using the chime_tts.say_url service with notify.alexa_media should work, but since v1.0.0 you can simply use chime_tts.say and specify your Alexa media_player, which should simplify your script.

It’s not clear which service is throwing the Message malformed: extra keys not allowed @ data['sequence'] error. It would be helpful to see the debug logs to determine where this error occurs.

To debug the problem I suggest you call chime_tts.say via the Services tab in the Developer tools page, that way you will be able to tell if the issue is related to Chime TTS. If not, it’s likely an issue with your scipt.

Either way: the debug logs are the best way for me to understand what the issue might be.

Hi Steffen, sorry to hear you’re experiencing this issue.

Thank you for the debug logs. Unfortunately they don’t reveal any clues, as they indicate that the correct steps were taken by Chime TTS.

My best guess as to what is causing the issue, is that after fading out and pausing the playing music, the Chime TTS audio announcement replaces the paused music, so there isn’t anything to resume.

Could you try setting the announce parameter to true? I am curious if that might fix the issue. Eg:

service: chime_tts.say
data:
chime_path: ding_dong
offset: 450
final_delay: 100
message: Hallo dies ist ein Test
tts_platform: edge_tts
volume_level: 0.6
fade_audio: true
announce: true
target:
entity_id: media_player.sonos_buero

Hi Dave, this issue looks like it might be related to Steffen’s post.

Could you please review my response and also try to see if setting announce to true addresses the issue?

Hi @Desert_AIP, I think the issue you’re having of the blank audio from Amazon Polly is due to an incorrect/missing configuration for the Amazon Polly platform in your Home Assistant instance, as these errors indicate that Chime TTS wasn’t able to find it in the list of installed TTS platforms.

Have you been able to successfully use the Amazon Polly TTS platform outside of Chime TTS, i,e with the tts.amazon_polly_say service?

Hi Robert, sorry to hear you’re unable to join the speakers together.

I don’t see any issues with your YAML. Can you please provide me with the debug log messages so that I might be able to see where the issue might be?

Hi @stormshaker, thank you for your kind words, I appreciate the support!


  1. Cache doesn’t work for me, it throws an Unknown Error. I’m using a rPi4 with HASSOS.

I suggest you try installing the latest beta version (v1.1.0-beta4) and see if it addresses the issue.

If you still expereince the issue on the beta then please provide me with your debug log messages so that I might be able to see what the issue is.


  1. …music continues playing 100% for another 1 second, then music volume returns to 15%.

For this issue I would again ask you to send me your debug log messages as it’s difficult to tell what could be causing the issue without any additionhal information.