chime_tts icon indicating copy to clipboard operation
chime_tts copied to clipboard

Issues playing on Sonos speakers with 1.1.0b4

Open dimatx opened this issue 2 years ago • 33 comments

System Health details

System Information

version core-2024.4.3
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.2
os_name Linux
os_version 6.6.25-haos
arch x86_64
timezone America/New_York
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 4686
Installed Version 1.34.0
Stage running
Available Repositories 1475
Downloaded Repositories 53
Home Assistant Cloud
logged_in true
subscription_expiration July 31, 2024 at 8:00 PM
relayer_connected true
relayer_region us-east-1
remote_enabled true
remote_connected true
alexa_enabled false
google_enabled true
remote_server us-east-1-2.ui.nabu.casa
certificate_status ready
instance_id 4d1962f7fd7c473ca4ec4547c83362bf
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 12.2
update_channel stable
supervisor_version supervisor-2024.04.0
agent_version 1.6.0
docker_version 25.0.5
disk_total 30.8 GB
disk_used 11.7 GB
healthy true
supported true
board ova
supervisor_api ok
version_api ok
installed_addons Studio Code Server (5.15.0), Terminal & SSH (9.13.0), Duck DNS (1.16.0), AppDaemon (0.16.4), Advanced SSH & Web Terminal (17.2.0), Home Assistant Google Drive Backup (0.112.1), InfluxDB (5.0.0), Victoria Metrics Agent add-on (1.8.19.9), Syncthing (1.19.0)
Dashboards
dashboards 9
resources 19
views 50
mode storage
Recorder
oldest_recorder_run April 11, 2024 at 3:24 PM
current_recorder_run April 19, 2024 at 12:47 PM
database_engine mysql
database_version 10.8.8

Checklist

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

Describe the issue

Trying to 1.1.0b4 to see if https://github.com/nimroddolev/chime_tts/issues/113 addressed by echo/out of sync issues, but seeing some issues with playing on my Sonos speakers. Whether I group or not, or use announce or not, the audio plays on just one speaker, but three times instead of once. It doesn't play at all on the other speaker.

Reproduction steps

  1. Create and run Chime TTS Say using the following config:
service: chime_tts.say
metadata: {}
data:
  chime_path: custom_chime_path_1
  message: This is a test message.
  tts_platform: microsoft
  cache: true
  announce: true
  join_players: true
  unjoin_players: true
target:
  entity_id:
    - media_player.kitchen_sonos
    - media_player.his_office_sonos
  1. The output plays three times on one speaker, and doesn't play at all on the second speaker.

Debug logs

2024-04-19 13:12:42.528 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Called. Version v1.1.0-beta4 -----
2024-04-19 13:12:42.529 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Adding service call to queue
2024-04-19 13:12:42.532 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ----- General Parameters -----
2024-04-19 13:12:42.532 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * entity_ids:
2024-04-19 13:12:42.532 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 0: media_player.kitchen_sonos
2024-04-19 13:12:42.532 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 1: media_player.his_office_sonos
2024-04-19 13:12:42.532 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * chime_path = custom_chime_path_1
2024-04-19 13:12:42.532 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * cache = True
2024-04-19 13:12:42.532 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * offset = 450.0
2024-04-19 13:12:42.532 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * final_delay = 0.0
2024-04-19 13:12:42.532 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * media_players_array:
2024-04-19 13:12:42.532 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 0: {'entity_id': 'media_player.kitchen_sonos', 'platform': 'sonos', 'should_change_volume': False, 'initial_volume_level': 0.01, 'playback_volume_level': -1, 'group_members_supported': True, 'announce_supported': True, 'is_playing': False}
2024-04-19 13:12:42.533 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 1: {'entity_id': 'media_player.his_office_sonos', 'platform': 'sonos', 'should_change_volume': False, 'initial_volume_level': 0.01, 'playback_volume_level': -1, 'group_members_supported': True, 'announce_supported': True, 'is_playing': False}
2024-04-19 13:12:42.533 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * message = This is a test message.
2024-04-19 13:12:42.533 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_platform = microsoft
2024-04-19 13:12:42.533 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_speed = 100.0
2024-04-19 13:12:42.533 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_pitch = 0
2024-04-19 13:12:42.533 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * announce = True
2024-04-19 13:12:42.533 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * fade_audio = False
2024-04-19 13:12:42.533 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * volume_level = -1
2024-04-19 13:12:42.533 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * join_players = False
2024-04-19 13:12:42.533 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * unjoin_players = False
2024-04-19 13:12:42.536 DEBUG (MainThread) [custom_components.chime_tts]  *** Checking Chime TTS audio cache ***
2024-04-19 13:12:42.542 DEBUG (MainThread) [custom_components.chime_tts]    ...no cached audio found
2024-04-19 13:12:42.542 DEBUG (MainThread) [custom_components.chime_tts]  - Retrieving audio from path: "/config/www/sound/zapsplat_household_doorbell_chime_bell_001_73122.mp3"...
2024-04-19 13:12:42.719 DEBUG (MainThread) [custom_components.chime_tts]    ...audio retrieved. Duration: 2.513s
2024-04-19 13:12:42.720 DEBUG (MainThread) [custom_components.chime_tts]  - Attempting to retrieve TTS audio from cache...
2024-04-19 13:12:42.729 DEBUG (MainThread) [custom_components.chime_tts]    ...no cached TTS audio found
2024-04-19 13:12:42.729 DEBUG (MainThread) [custom_components.chime_tts]  - Generating new TTS audio with parameters:
2024-04-19 13:12:42.730 DEBUG (MainThread) [custom_components.chime_tts]     * tts_platform = 'microsoft'
2024-04-19 13:12:42.730 DEBUG (MainThread) [custom_components.chime_tts]     * message = 'This is a test message.'
2024-04-19 13:12:42.730 DEBUG (MainThread) [custom_components.chime_tts]     * cache = True
2024-04-19 13:12:42.730 DEBUG (MainThread) [custom_components.chime_tts]     * language = None
2024-04-19 13:12:42.730 DEBUG (MainThread) [custom_components.chime_tts]     * options = {}
2024-04-19 13:12:43.301 DEBUG (MainThread) [custom_components.chime_tts]    ...TTS audio generated in 570.0ms
2024-04-19 13:12:43.301 DEBUG (MainThread) [custom_components.chime_tts]  - Saving generated TTS audio to cache...
2024-04-19 13:12:43.476 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem]  - File saved to path: /media/sounds/temp/chime_tts/b0ooi54a.mp3
2024-04-19 13:12:43.476 DEBUG (MainThread) [custom_components.chime_tts]  - Saving data to chime_tts storage:
2024-04-19 13:12:43.476 DEBUG (MainThread) [custom_components.chime_tts]    - key:   "c30da12e265e4c0405246fd77c298aee34f168672af0f2ac58cd869aaf025577"
2024-04-19 13:12:43.476 DEBUG (MainThread) [custom_components.chime_tts]    - value: "{'local_path': '/media/sounds/temp/chime_tts/b0ooi54a.mp3', 'audio_duration': 2.424}"
2024-04-19 13:12:43.505 DEBUG (MainThread) [custom_components.chime_tts]   ...TTS audio saved to cache
2024-04-19 13:12:43.522 DEBUG (MainThread) [custom_components.chime_tts]  - Saving mp3 file to folder: /media/sounds/temp/chime_tts/...
2024-04-19 13:12:43.800 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem]  - File saved to path: /media/sounds/temp/chime_tts/5quqv0at.mp3
2024-04-19 13:12:43.993 DEBUG (MainThread) [custom_components.chime_tts]  - Saving data to chime_tts storage:
2024-04-19 13:12:43.993 DEBUG (MainThread) [custom_components.chime_tts]    - key:   "1ebbd34f8db06341bdcffeb392ab9b592aabe9ef615ea5c90e17630ca1b7fc95"
2024-04-19 13:12:43.993 DEBUG (MainThread) [custom_components.chime_tts]    - value: "{'local_path': '/media/sounds/temp/chime_tts/5quqv0at.mp3', 'audio_duration': 5.387}"
2024-04-19 13:12:43.996 DEBUG (MainThread) [custom_components.chime_tts]  - Chime TTS audio generated:
2024-04-19 13:12:43.996 DEBUG (MainThread) [custom_components.chime_tts]    - audio_duration = 5.387
2024-04-19 13:12:43.996 DEBUG (MainThread) [custom_components.chime_tts]    - local_path = "/media/sounds/temp/chime_tts/5quqv0at.mp3"
2024-04-19 13:12:43.996 DEBUG (MainThread) [custom_components.chime_tts]    - public_path = None
2024-04-19 13:12:43.996 DEBUG (MainThread) [custom_components.chime_tts]    - media_content_id = "media-source://media_source/local/sounds/temp/chime_tts/5quqv0at.mp3"
2024-04-19 13:12:43.996 DEBUG (MainThread) [custom_components.chime_tts]  *** Pre-Playback Actions *** 
2024-04-19 13:12:43.996 DEBUG (MainThread) [custom_components.chime_tts]  *** Chime TTS playback ***
2024-04-19 13:12:44.007 DEBUG (MainThread) [custom_components.chime_tts]    2 Sonos media players detected:
2024-04-19 13:12:44.008 DEBUG (MainThread) [custom_components.chime_tts]      - media_player.kitchen_sonos
2024-04-19 13:12:44.008 DEBUG (MainThread) [custom_components.chime_tts] sonos_media_player_dict = {'entity_id': 'media_player.kitchen_sonos', 'platform': 'sonos', 'should_change_volume': False, 'initial_volume_level': 0.01, 'playback_volume_level': -1, 'group_members_supported': True, 'announce_supported': True, 'is_playing': False}
2024-04-19 13:12:44.008 DEBUG (MainThread) [custom_components.chime_tts]      - media_player.his_office_sonos
2024-04-19 13:12:44.008 DEBUG (MainThread) [custom_components.chime_tts] sonos_media_player_dict = {'entity_id': 'media_player.his_office_sonos', 'platform': 'sonos', 'should_change_volume': False, 'initial_volume_level': 0.01, 'playback_volume_level': -1, 'group_members_supported': True, 'announce_supported': True, 'is_playing': False}
2024-04-19 13:12:44.008 DEBUG (MainThread) [custom_components.chime_tts]    Calling media_player.play_media with data:
2024-04-19 13:12:44.008 DEBUG (MainThread) [custom_components.chime_tts]      - media_content_type: music
2024-04-19 13:12:44.008 DEBUG (MainThread) [custom_components.chime_tts]      - media_content_id: media-source://media_source/local/sounds/temp/chime_tts/5quqv0at.mp3
2024-04-19 13:12:44.009 DEBUG (MainThread) [custom_components.chime_tts]      - announce: True
2024-04-19 13:12:44.009 DEBUG (MainThread) [custom_components.chime_tts]      - entity_id: ['media_player.his_office_sonos']
2024-04-19 13:12:44.016 DEBUG (MainThread) [custom_components.chime_tts]    Calling media_player.play_media with data:
2024-04-19 13:12:44.016 DEBUG (MainThread) [custom_components.chime_tts]      - media_content_type: music
2024-04-19 13:12:44.016 DEBUG (MainThread) [custom_components.chime_tts]      - media_content_id: media-source://media_source/local/sounds/temp/chime_tts/5quqv0at.mp3
2024-04-19 13:12:44.016 DEBUG (MainThread) [custom_components.chime_tts]      - announce: True
2024-04-19 13:12:44.016 DEBUG (MainThread) [custom_components.chime_tts]      - entity_id: ['media_player.his_office_sonos']
2024-04-19 13:12:44.021 DEBUG (MainThread) [custom_components.chime_tts]    Calling media_player.play_media with data:
2024-04-19 13:12:44.021 DEBUG (MainThread) [custom_components.chime_tts]      - media_content_type: music
2024-04-19 13:12:44.021 DEBUG (MainThread) [custom_components.chime_tts]      - media_content_id: media-source://media_source/local/sounds/temp/chime_tts/5quqv0at.mp3
2024-04-19 13:12:44.021 DEBUG (MainThread) [custom_components.chime_tts]      - announce: True
2024-04-19 13:12:44.021 DEBUG (MainThread) [custom_components.chime_tts]      - entity_id: ['media_player.his_office_sonos']
2024-04-19 13:12:44.024 DEBUG (MainThread) [custom_components.chime_tts]  - Waiting 5.387s for audio playback to complete...
2024-04-19 13:12:49.415 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]  - Waiting until 2 media_players aren't playing...
2024-04-19 13:12:49.415 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]    ✔ media_player.kitchen_sonos
2024-04-19 13:12:49.617 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]    ✔ media_player.his_office_sonos
2024-04-19 13:12:49.617 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Completed in 7.09 s -----

Diagnostics dump

No response

dimatx avatar Apr 19 '24 17:04 dimatx

Pretty much the same issue also with my 2 Sonos speaker, if I touch the volume then no tts, the volume lower and come back correctly but no speaking, if I don’t touch the volume option then tts will speak correctly but it’s not loud enough.

Legrand5382 avatar Apr 21 '24 01:04 Legrand5382

Same issue here. It works correctly if announce=False but don't resume the playback, what is pretty annoying :)

serotonie avatar Apr 22 '24 08:04 serotonie

I can't get it to work irrespective of the announce parameter or the volume. Reverted back to stable for now.

dimatx avatar Apr 22 '24 13:04 dimatx

I do have tts, but at a substantial lower volume, almost inaudible. The loud music after the tts is resolved with beta 4.

  - service: chime_tts.say
    target:
      entity_id:
        - media_player.keuken
        - media_player.woonkamer
        - media_player.kantoor
    data:
      tts_playback_speed: 110
      volume_level: 0.5
      message: bla bla
      tts_platform: cloud
      join_players: true
      unjoin_players: true
      announce: true

HA-TB303 avatar Apr 28 '24 17:04 HA-TB303

Can confirm same issue, as soon as I put announce on false it works again...

Flight777 avatar May 03 '24 19:05 Flight777

Curious if others on this thread actually have a Sonos working flawlessly with stable versions. I find that speakers frequently are out of sync with each other. As a band aid, I found that playing a silent clip as a separate service call before the actual announcement, and then calling the service for the actual announcement does help, but it's not rock solid.

dimatx avatar May 06 '24 13:05 dimatx

Hi everyone.

Thank you all for posting about the issues you've experienced with the joined speakers, Sonos in particular.

I have been working on these issues, but as I don't own any Sonos or other speakers that support being joined, I have been unable to verify the fix - so I ask for your patience and understanding if it might take a bit more back and forth until I can get it right.

I just released a new beta version, v1.1.0-beta5, which I hope addresses these issues.

I would be very appreciative if you could please upgrade to the new version and let me know what your experiences are. When reporting back, please include debug log messages so that I might better understand where the issue/s occur.

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

nimroddolev avatar May 09 '24 19:05 nimroddolev

Hey @nimroddolev - Appreciate your efforts to get this fixed despite not having test devices. Happy to help as much as I can.

So, Beta 5 is definitely a step in the right direction. Here's what I'm seeing... The audio plays, and is in sync :) However, it appear that it will play at whatever volume the speakers are already at. The volume adjustment does not seem to apply.

There's also a service call timeout error that throws, but functionality does not seem impeded.

Happy to test with other inputs if desired.

My call

service: chime_tts.say
data:
  delay: 300
  final_delay: 100
  volume_level: 0.35
  message: This is a test message. Will the message play in sync???
  tts_platform: microsoft
  chime_path: custom_chime_path_5
  cache: false
  announce: false
  join_players: true
target:
  entity_id:
    - media_player.bedroom_sonos
    - media_player.kitchen_sonos
    - media_player.his_office_sonos
    - media_player.her_office_sonos
    - media_player.gym_sonos
enabled: true
alias: Microsoft TTS

DEBUG log

2024-05-09 15:36:03.937 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Called. Version v1.1.0-beta5 -----
2024-05-09 15:36:03.937 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Adding service call to queue
2024-05-09 15:36:03.944 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ----- General Parameters -----
2024-05-09 15:36:03.944 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * entity_ids:
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 0: media_player.kitchen_sonos
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 1: media_player.bedroom_sonos
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 2: media_player.his_office_sonos
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 3: media_player.her_office_sonos
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 4: media_player.gym_sonos
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * chime_path = custom_chime_path_5
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * cache = False
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * offset = 300.0
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * final_delay = 100.0
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * media_players_array:
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 0: {'entity_id': 'media_player.kitchen_sonos', 'platform': 'sonos', 'should_change_volume': True, 'initial_volume_level': 0.28, 'playback_volume_level': 0.35, 'group_members_supported': True, 'announce_supported': True, 'is_playing': False}
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 1: {'entity_id': 'media_player.bedroom_sonos', 'platform': 'sonos', 'should_change_volume': True, 'initial_volume_level': 0.29, 'playback_volume_level': 0.35, 'group_members_supported': True, 'announce_supported': True, 'is_playing': False}
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 2: {'entity_id': 'media_player.his_office_sonos', 'platform': 'sonos', 'should_change_volume': True, 'initial_volume_level': 0.31, 'playback_volume_level': 0.35, 'group_members_supported': True, 'announce_supported': True, 'is_playing': False}
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 3: {'entity_id': 'media_player.her_office_sonos', 'platform': 'sonos', 'should_change_volume': True, 'initial_volume_level': 0.3, 'playback_volume_level': 0.35, 'group_members_supported': True, 'announce_supported': True, 'is_playing': False}
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]    - 4: {'entity_id': 'media_player.gym_sonos', 'platform': 'sonos', 'should_change_volume': True, 'initial_volume_level': 0.3, 'playback_volume_level': 0.35, 'group_members_supported': True, 'announce_supported': True, 'is_playing': False}
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * message = This is a test message. Will the message play in sync???
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_platform = microsoft
2024-05-09 15:36:03.945 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_speed = 100.0
2024-05-09 15:36:03.946 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * tts_pitch = 0
2024-05-09 15:36:03.946 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * announce = False
2024-05-09 15:36:03.946 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * fade_audio = False
2024-05-09 15:36:03.946 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * volume_level = 0.35
2024-05-09 15:36:03.946 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * join_players = True
2024-05-09 15:36:03.946 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers]  * unjoin_players = False
2024-05-09 15:36:03.949 DEBUG (MainThread) [custom_components.chime_tts]  - Retrieving audio from path: "/config/www/sound/new-notification-on-your-device-138695.mp3"...
2024-05-09 15:36:04.130 DEBUG (MainThread) [custom_components.chime_tts]    ...audio retrieved. Duration: 3.527s
2024-05-09 15:36:04.131 DEBUG (MainThread) [custom_components.chime_tts]  - Generating new TTS audio with parameters:
2024-05-09 15:36:04.131 DEBUG (MainThread) [custom_components.chime_tts]     * tts_platform = 'microsoft'
2024-05-09 15:36:04.131 DEBUG (MainThread) [custom_components.chime_tts]     * message = 'This is a test message. Will the message play in sync???'
2024-05-09 15:36:04.131 DEBUG (MainThread) [custom_components.chime_tts]     * cache = False
2024-05-09 15:36:04.131 DEBUG (MainThread) [custom_components.chime_tts]     * language = None
2024-05-09 15:36:04.131 DEBUG (MainThread) [custom_components.chime_tts]     * options = {}
2024-05-09 15:36:04.729 DEBUG (MainThread) [custom_components.chime_tts]    ...TTS audio generated in 600.0ms
2024-05-09 15:36:04.747 DEBUG (MainThread) [custom_components.chime_tts]  - Saving mp3 file to folder: /media/sounds/temp/chime_tts/...
2024-05-09 15:36:05.085 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem]  - File saved to path: /media/sounds/temp/chime_tts/ktfq7bc5.mp3
2024-05-09 15:36:05.257 DEBUG (MainThread) [custom_components.chime_tts]  - Chime TTS audio generated:
2024-05-09 15:36:05.257 DEBUG (MainThread) [custom_components.chime_tts]    - audio_duration = 8.626
2024-05-09 15:36:05.257 DEBUG (MainThread) [custom_components.chime_tts]    - local_path = "/media/sounds/temp/chime_tts/ktfq7bc5.mp3"
2024-05-09 15:36:05.257 DEBUG (MainThread) [custom_components.chime_tts]    - public_path = None
2024-05-09 15:36:05.257 DEBUG (MainThread) [custom_components.chime_tts]    - media_content_id = "media-source://media_source/local/sounds/temp/chime_tts/ktfq7bc5.mp3"
2024-05-09 15:36:05.257 DEBUG (MainThread) [custom_components.chime_tts]  *** Pre-Playback Actions *** 
2024-05-09 15:36:05.270 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]    - Calling media_player.join service for 5 media_player entities...
2024-05-09 15:36:05.270 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]    - Joining 5 media_player entities:
2024-05-09 15:36:05.270 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]      - media_player.kitchen_sonos
2024-05-09 15:36:05.270 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]      - media_player.bedroom_sonos
2024-05-09 15:36:05.270 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]      - media_player.his_office_sonos
2024-05-09 15:36:05.270 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]      - media_player.her_office_sonos
2024-05-09 15:36:05.270 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]      - media_player.gym_sonos
2024-05-09 15:36:05.285 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player]      ...done
2024-05-09 15:36:05.287 DEBUG (MainThread) [custom_components.chime_tts]  *** Chime TTS playback ***
2024-05-09 15:36:05.299 DEBUG (MainThread) [custom_components.chime_tts] Removing joined entity_ids: ['media_player.kitchen_sonos', 'media_player.bedroom_sonos', 'media_player.his_office_sonos', 'media_player.her_office_sonos', 'media_player.gym_sonos']
2024-05-09 15:36:05.300 DEBUG (MainThread) [custom_components.chime_tts]    1 Standard media player detected:
2024-05-09 15:36:05.300 DEBUG (MainThread) [custom_components.chime_tts]      - media_player.kitchen_sonos
2024-05-09 15:36:05.300 DEBUG (MainThread) [custom_components.chime_tts]    Calling media_player.play_media with data:
2024-05-09 15:36:05.300 DEBUG (MainThread) [custom_components.chime_tts]      - media_content_type: music
2024-05-09 15:36:05.300 DEBUG (MainThread) [custom_components.chime_tts]      - media_content_id: media-source://media_source/local/sounds/temp/chime_tts/ktfq7bc5.mp3
2024-05-09 15:36:05.300 DEBUG (MainThread) [custom_components.chime_tts]      - entity_id: ['media_player.kitchen_sonos']
2024-05-09 15:36:05.301 DEBUG (MainThread) [custom_components.chime_tts]  - Waiting 8.726s for audio playback to complete...
2024-05-09 15:36:13.938 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: Service call timed out
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 501, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/chime_tts/__init__.py", line 119, in async_say
    result = await queue.add_to_queue(async_say_execute, service, is_say_url)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Exception: Service call timed out
2024-05-09 15:36:13.939 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140232673914944] Error handling message: Unknown error (unknown_error) Dima from 192.168.7.103 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 793, in handle_execute_script
    script_result = await script_obj.async_run(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1731, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 503, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 533, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 501, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2738, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2779, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/chime_tts/__init__.py", line 119, in async_say
    result = await queue.add_to_queue(async_say_execute, service, is_say_url)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Exception: Service call timed out

dimatx avatar May 09 '24 19:05 dimatx

Thanks @dimatx for your assistance and the debug log messages 👍

The volume adjustment does not seem to apply

I believe I isolated the volume issue and I released a new beta version with a potential fix, v1.1.0-beta6. Can you please install the new beta and let me know if there's any improvement?

There's also a service call timeout error that throws, but functionality does not seem impeded.

I reviewed the changes over the last couple release and I can't see a likely cause for this issue.

  • Does it consistently happen with each service call to chime_tts.say?
  • If not, are you able to determine if there are any steps to reproduce the issue?

nimroddolev avatar May 10 '24 06:05 nimroddolev

Thanks @nimroddolev for your diligence with getting this resolved. I will do some testing this weekend, but upon a quick test it does seem there are still issues with setting the volume, but I need to systematically test to give you actionable input as it seemed to have worked sometimes but not every time. At first I thought it was only working when join and unjoin are both true, but then it worked with just join, so I am not sure anymore.

I also found that while b5 and b6 work well with 'announce: false', when 'announce: true', I hear music playing from some but not all speakers.

I'll collect more logs over the weekend and share.

Also, I still get that 'error' after each call, happens each time without exception, but I can't tell any adverse impact to report.

Would be curious to hear from others just to make sure it's not just me.

dimatx avatar May 10 '24 12:05 dimatx

I don't know if this will help much:

Beta 1.1.0-beta5

service: chime_tts.say
data:
  message: Dit is een test
  volume_level: 0.3
  chime_path: chirp
  join_players: true
  unjoin_players: true
  announce: false
target:
  entity_id:
    - media_player.kantoor
    - media_player.woonkamer
    - media_player.keuken

Plays on all 3 speakers, but silences music and music does not continue

service: chime_tts.say
data:
  message: Dit is een test
  volume_level: 0.3
  chime_path: chirp
  join_players: true
  unjoin_players: true
  announce: true
target:
  entity_id:
    - media_player.kantoor
    - media_player.woonkamer
    - media_player.keuken

Plays on media_player.keuken only, silences music and music does not continue

If I can test anything else, let me know.

HA-TB303 avatar May 10 '24 20:05 HA-TB303

It might also be useful if you could please provide me with the YAML for how you regularly use TTS with your Sonos media players. It's possible i've made some incorrect assumptions early on.

nimroddolev avatar May 11 '24 17:05 nimroddolev

What yaml do you need?

Automation:

alias: Mailbox notification
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.brievenbus_legen
    from: "off"
    to: "on"
condition: []
action:
  - service: chime_tts.say
    metadata: {}
    data:
      volume_level: 0.35
      chime_path: bells_2
      message: Mail has been delivered.
      tts_platform: cloud
      announce: true
      join_players: true
      unjoin_players: true
      cache: true
    target:
      entity_id:
        - media_player.kantoor
        - media_player.keuken
        - media_player.woonkamer
mode: single
initial_state: true

When I launch this with Chime TTS v1.0.0 it only plays on: - media_player.keuken - media_player.woonkamer Not on media_player.kantoor, which is a Sonos ERA100.

The tts is properly announced on the speakers, but the music level goes very loud right after the tts and then returns to normal.

If I do exactly the same with Chime TTS v1.1.0-beta6 it only plays on: - media_player.keuken - media_player.woonkamer Not on media_player.kantoor, which is a Sonos ERA100.

The music goes loud just a fraction of a second BEFORE the tts, the TTS is properly announced but thereafter the music does NOT return.

HA-TB303 avatar May 12 '24 11:05 HA-TB303

I think the tts issue with the SONOS ERA 100 seems unrelated to Chime tts as that does not work with normal tts either. Probably yet another Sonos bug.

The rest seems to be Chime TTS related.

HA-TB303 avatar May 12 '24 11:05 HA-TB303

Thanks @HA-TB303, could you also please provide me with the debug log messages for the associated service calls to chime_tts.say? Also - could you share with me any automations/scripts you might have where you have successfully joined speakers together and paused/resumed music?

nimroddolev avatar May 12 '24 11:05 nimroddolev

I do not have any automations to join speakers. I use Chime TTS for that.

How to I debug log service calls? I was unable to find any information about it. In the regular logs there is no relevant information.

HA-TB303 avatar May 12 '24 11:05 HA-TB303

Apologies, I forgot to include the steps to enable debug logging:

  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

nimroddolev avatar May 12 '24 11:05 nimroddolev

Ok, I'll make a log hereafter.

Fot now I have testd this:

alias: Test Sonos Join/unjoin
description: ""
trigger: []
condition: []
action:
  - service: media_player.join
    metadata: {}
    data:
      group_members:
        - media_player.keuken
    target:
      entity_id:
        - media_player.woonkamer
  - service: media_player.play_media
    metadata: {}
    data:
      announce: true
      media_content_type: music
      media_content_id: media-source://tts/cloud?message="Dit is een test"
    target:
      entity_id: media_player.woonkamer
  - service: media_player.unjoin
    metadata: {}
    data: {}
    target:
      entity_id: media_player.woonkamer
mode: single

With really funky results:

It mutes the music media_player.woonkamer, plays tts only on media_player.woonkamer and then resumes music on media_player.keuken.

This buggy Sonos stuff really starts to piss me off. Spends thousands on a proper multiroom setup and it works like crap. Not anybodies fault, but extremely annoying... :(

HA-TB303 avatar May 12 '24 11:05 HA-TB303

ran:

service: chime_tts.say
data:
  message: Dit is een test
  volume_level: 0.3
  chime_path: chirp
  join_players: true
  unjoin_players: true
  announce: true
target:
  entity_id:
    - media_player.kantoor
    - media_player.woonkamer
    - media_player.keuken

2024-05-12 13:07:49.005 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-05-12 13:56:12.065 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Called. Version v1.1.0-beta6 -----
2024-05-12 13:56:12.065 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Adding service call to queue
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ----- General Parameters -----
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * entity_ids:
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] - 0: media_player.keuken
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] - 1: media_player.woonkamer
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] - 2: media_player.kantoor
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * chime_path = chirp
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * cache = False
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * offset = 450.0
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * final_delay = 0.0
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * media_players_array:
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] - 0: {'entity_id': 'media_player.keuken', 'platform': 'sonos', 'should_change_volume': True, 'initial_volume_level': 0.32, 'playback_volume_level': 0.3, 'group_members_supported': True, 'announce_supported': True, 'is_playing': True}
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] - 1: {'entity_id': 'media_player.woonkamer', 'platform': 'sonos', 'should_change_volume': True, 'initial_volume_level': 0.2, 'playback_volume_level': 0.3, 'group_members_supported': True, 'announce_supported': True, 'is_playing': False}
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] - 2: {'entity_id': 'media_player.kantoor', 'platform': 'sonos', 'should_change_volume': True, 'initial_volume_level': 0.3, 'playback_volume_level': 0.3, 'group_members_supported': True, 'announce_supported': True, 'is_playing': False}
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * message = Dit is een test
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * tts_speed = 100.0
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * tts_pitch = 0
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * announce = True
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * fade_audio = False
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * volume_level = 0.3
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * join_players = True
2024-05-12 13:56:12.069 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * unjoin_players = True
2024-05-12 13:56:12.070 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem] Local path to chime: /config/custom_components/chime_tts/mp3s/chirp.mp3
2024-05-12 13:56:12.070 DEBUG (MainThread) [custom_components.chime_tts] - Retrieving audio from path: "/config/custom_components/chime_tts/mp3s/chirp.mp3"...
2024-05-12 13:56:12.153 DEBUG (MainThread) [custom_components.chime_tts] ...audio retrieved. Duration: 0.395s
2024-05-12 13:56:12.153 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] - No `tts_platform` parameter provided. Using 'edge_tts'
2024-05-12 13:56:12.153 DEBUG (MainThread) [custom_components.chime_tts] - Generating new TTS audio with parameters:
2024-05-12 13:56:12.153 DEBUG (MainThread) [custom_components.chime_tts] * tts_platform = 'edge_tts'
2024-05-12 13:56:12.153 DEBUG (MainThread) [custom_components.chime_tts] * message = 'Dit is een test'
2024-05-12 13:56:12.153 DEBUG (MainThread) [custom_components.chime_tts] * cache = False
2024-05-12 13:56:12.153 DEBUG (MainThread) [custom_components.chime_tts] * language = None
2024-05-12 13:56:12.153 DEBUG (MainThread) [custom_components.chime_tts] * options = {}
2024-05-12 13:56:12.234 DEBUG (MainThread) [custom_components.chime_tts] ...TTS audio generated in 80.0ms
2024-05-12 13:56:12.240 DEBUG (MainThread) [custom_components.chime_tts] - Saving mp3 file to folder: /media/sounds/temp/chime_tts/...
2024-05-12 13:56:12.332 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem] File saved to path: /media/sounds/temp/chime_tts/d_dfbsdv.mp3
2024-05-12 13:56:12.418 DEBUG (MainThread) [custom_components.chime_tts] - Chime TTS audio generated:
2024-05-12 13:56:12.418 DEBUG (MainThread) [custom_components.chime_tts] * audio_duration = 3.125
2024-05-12 13:56:12.418 DEBUG (MainThread) [custom_components.chime_tts] * local_path = "/media/sounds/temp/chime_tts/d_dfbsdv.mp3"
2024-05-12 13:56:12.418 DEBUG (MainThread) [custom_components.chime_tts] * public_path = None
2024-05-12 13:56:12.418 DEBUG (MainThread) [custom_components.chime_tts] * media_content_id = "media-source://media_source/local/sounds/temp/chime_tts/d_dfbsdv.mp3"
2024-05-12 13:56:12.418 DEBUG (MainThread) [custom_components.chime_tts] *** Pre-Playback Actions ***
2024-05-12 13:56:12.420 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - Decresing media_player.keuken's volume from 0.32 to 0.3
2024-05-12 13:56:12.435 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - Increasing media_player.woonkamer's volume from 0.2 to 0.3
2024-05-12 13:56:12.446 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - Calling media_player.join service for 3 media_player entities...
2024-05-12 13:56:12.446 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - Joining 3 media_player entities:
2024-05-12 13:56:12.446 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - media_player.keuken
2024-05-12 13:56:12.446 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - media_player.woonkamer
2024-05-12 13:56:12.446 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - media_player.kantoor
2024-05-12 13:56:14.023 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] ...done
2024-05-12 13:56:14.025 DEBUG (MainThread) [custom_components.chime_tts] *** Chime TTS playback ***
2024-05-12 13:56:14.029 DEBUG (MainThread) [custom_components.chime_tts] Removing joined entity_ids: ['media_player.keuken', 'media_player.woonkamer', 'media_player.kantoor']
2024-05-12 13:56:14.029 DEBUG (MainThread) [custom_components.chime_tts] 1 Standard media player detected:
2024-05-12 13:56:14.029 DEBUG (MainThread) [custom_components.chime_tts] - media_player.keuken
2024-05-12 13:56:14.029 DEBUG (MainThread) [custom_components.chime_tts] Calling media_player.play_media with data:
2024-05-12 13:56:14.029 DEBUG (MainThread) [custom_components.chime_tts] - media_content_type: music
2024-05-12 13:56:14.029 DEBUG (MainThread) [custom_components.chime_tts] - media_content_id: media-source://media_source/local/sounds/temp/chime_tts/d_dfbsdv.mp3
2024-05-12 13:56:14.029 DEBUG (MainThread) [custom_components.chime_tts] - announce: True
2024-05-12 13:56:14.029 DEBUG (MainThread) [custom_components.chime_tts] - entity_id: ['media_player.keuken']
2024-05-12 13:56:14.032 DEBUG (MainThread) [custom_components.chime_tts] - Waiting 3.125s for audio playback to complete...
2024-05-12 13:56:17.159 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - Waiting until 3 media_players aren't playing...
2024-05-12 13:56:20.767 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] 𝘅 media_player.keuken - Timed out
2024-05-12 13:56:20.767 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] 𝘅 media_player.woonkamer - Timed out
2024-05-12 13:56:20.767 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] 𝘅 media_player.kantoor - Timed out
2024-05-12 13:56:20.767 DEBUG (MainThread) [custom_components.chime_tts] - Timed out waiting for playback to complete
2024-05-12 13:56:20.767 DEBUG (MainThread) [custom_components.chime_tts] *** Post-Playback Actions ***
2024-05-12 13:56:20.767 DEBUG (MainThread) [custom_components.chime_tts] - Calling media_player.unjoin service...
2024-05-12 13:56:20.767 DEBUG (MainThread) [custom_components.chime_tts] - media_player.unjoin: media_player.keuken
2024-05-12 13:56:22.871 DEBUG (MainThread) [custom_components.chime_tts] ...done
2024-05-12 13:56:22.871 DEBUG (MainThread) [custom_components.chime_tts] - media_player.unjoin: media_player.woonkamer
2024-05-12 13:56:27.382 DEBUG (MainThread) [custom_components.chime_tts] ...done
2024-05-12 13:56:27.382 DEBUG (MainThread) [custom_components.chime_tts] - media_player.unjoin: media_player.kantoor
2024-05-12 13:56:27.838 DEBUG (MainThread) [custom_components.chime_tts] ...done
2024-05-12 13:56:27.839 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Completed in 15.77 s -----

HA-TB303 avatar May 12 '24 11:05 HA-TB303

Thank you for the debug logs.

Could you also please tell me what ended up happening? Based on the logs it looks like:

  • The audio was generated successfully by Chime TTS
  • The volume levels for media_player.keuken and media_player.woonkamer were set to 0.3 (media_player.kantoor was already at the correct level)
  • The audio was played via media_player.play_media on the speaker group media_player.keuken, with announce set to true
  • None of the media players states returned to idle
  • Finally, the media players were unjoined

nimroddolev avatar May 12 '24 13:05 nimroddolev

OK,

media_player.woonkamer (a sonos arc) is playing a radio stream. I then fire:

service: chime_tts.say
data:
  message: "Dit is een test"
  volume_level: 0.4
  chime_path: chirp
  join_players: true
  unjoin_players: true
  announce: true
target:
  entity_id:
    - media_player.kantoor
    - media_player.woonkamer
    - media_player.keuken

What happens then:

  1. The radio stream turns loud, just before the chirp sound
  2. Radio stream goes silent.
  3. Chirp sound is played on the media_player.keuken only
  4. tts is announced on the media_player.keuken only
  5. Radio stream does not turn back on.

HA-TB303 avatar May 12 '24 18:05 HA-TB303

This all worked pretty well on version 1.0.0, just the radio stream turned loud for a short moment just after tts, and then turned back to normal.

It's the beta's that broke it completely.

HA-TB303 avatar May 12 '24 18:05 HA-TB303

Hi @HA-TB303,

Please remember that I do not own any Sonos hardware, so in order for me to work on these issues I require both the debug log messages as well as a description of what actually happened.

nimroddolev avatar May 13 '24 05:05 nimroddolev

Ok, will do next time. The above scenario is the exact same as the log (https://github.com/nimroddolev/chime_tts/issues/121#issuecomment-2106221777) above that. If there is anything else I can test, please let me now.

HA-TB303 avatar May 13 '24 06:05 HA-TB303

Thanks you 👍

I think the issue is that when using announce the volume adjustment for Sonos is meant to be done automatically, which is what I implemented previously, however now it is done manually before playing the Chime TTS audio.

Could you please check if using the fade_audio parameter instead of announce makes a difference?

nimroddolev avatar May 13 '24 07:05 nimroddolev

Hi, sure, but I'm not sure how to try this.

HA-TB303 avatar May 13 '24 07:05 HA-TB303

You can use the following YAML:

service: chime_tts.say
data:
  message: "Dit is een test"
  volume_level: 0.4
  chime_path: chirp
  join_players: true
  unjoin_players: true
  fade_audio: true
target:
  entity_id:
    - media_player.kantoor
    - media_player.woonkamer
    - media_player.keuken

nimroddolev avatar May 13 '24 08:05 nimroddolev

Just did the test. The results are extremely bizar....

  1. Music (radio stream) playing in media_player.woonkamer only.
  2. I launch the service call below
service: chime_tts.say
data:
  message: "Dit is een test"
  volume_level: 0.4
  chime_path: chirp
  join_players: true
  unjoin_players: true
  fade_audio: true
target:
  entity_id:
    - media_player.kantoor
    - media_player.woonkamer
    - media_player.keuken
  1. Music stopped
  2. I hear the chrip sound on media_player.keuken first
  3. I hear the TTS on media_player.keuken
  4. I Hear a chrip sound again on the media_player.keuken
  5. I hear the TTS on media_player.woonkamer
  6. a few seconds later....
  7. I hear a chirp sound on the media_player.kantoor
  8. I hear the TTS on the media_player.kantoor

Music does not continue

2024-05-13 18:13:29.412 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Called. Version v1.1.0-beta6 -----
2024-05-13 18:13:29.412 DEBUG (MainThread) [custom_components.chime_tts.queue_manager] Adding service call to queue
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] ----- General Parameters -----
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * entity_ids:
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] - 0: media_player.keuken
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] - 1: media_player.woonkamer
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] - 2: media_player.kantoor
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * chime_path = chirp
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * cache = False
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * offset = 450.0
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * final_delay = 0.0
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * media_players_array:
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] - 0: {'entity_id': 'media_player.keuken', 'platform': 'sonos', 'should_change_volume': True, 'initial_volume_level': 0.4, 'playback_volume_level': 0.4, 'group_members_supported': True, 'announce_supported': True, 'is_playing': False}
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] - 1: {'entity_id': 'media_player.woonkamer', 'platform': 'sonos', 'should_change_volume': True, 'initial_volume_level': 0.2, 'playback_volume_level': 0.4, 'group_members_supported': True, 'announce_supported': True, 'is_playing': False}
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] - 2: {'entity_id': 'media_player.kantoor', 'platform': 'sonos', 'should_change_volume': True, 'initial_volume_level': 0.4, 'playback_volume_level': 0.4, 'group_members_supported': True, 'announce_supported': True, 'is_playing': False}
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * message = Dit is een test
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * tts_speed = 100.0
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * tts_pitch = 0
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * announce = False
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * fade_audio = True
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * volume_level = 0.4
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * join_players = True
2024-05-13 18:13:29.416 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] * unjoin_players = True
2024-05-13 18:13:29.417 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem] Local path to chime: /config/custom_components/chime_tts/mp3s/chirp.mp3
2024-05-13 18:13:29.417 DEBUG (MainThread) [custom_components.chime_tts] - Retrieving audio from path: "/config/custom_components/chime_tts/mp3s/chirp.mp3"...
2024-05-13 18:13:29.497 DEBUG (MainThread) [custom_components.chime_tts] ...audio retrieved. Duration: 0.395s
2024-05-13 18:13:29.498 DEBUG (MainThread) [custom_components.chime_tts.helpers.helpers] - No `tts_platform` parameter provided. Using 'edge_tts'
2024-05-13 18:13:29.498 DEBUG (MainThread) [custom_components.chime_tts] - Generating new TTS audio with parameters:
2024-05-13 18:13:29.498 DEBUG (MainThread) [custom_components.chime_tts] * tts_platform = 'edge_tts'
2024-05-13 18:13:29.498 DEBUG (MainThread) [custom_components.chime_tts] * message = 'Dit is een test'
2024-05-13 18:13:29.498 DEBUG (MainThread) [custom_components.chime_tts] * cache = False
2024-05-13 18:13:29.498 DEBUG (MainThread) [custom_components.chime_tts] * language = None
2024-05-13 18:13:29.498 DEBUG (MainThread) [custom_components.chime_tts] * options = {}
2024-05-13 18:13:29.579 DEBUG (MainThread) [custom_components.chime_tts] ...TTS audio generated in 80.0ms
2024-05-13 18:13:29.585 DEBUG (MainThread) [custom_components.chime_tts] - Saving mp3 file to folder: /media/sounds/temp/chime_tts/...
2024-05-13 18:13:29.672 DEBUG (MainThread) [custom_components.chime_tts.helpers.filesystem] File saved to path: /media/sounds/temp/chime_tts/k37btgxj.mp3
2024-05-13 18:13:29.755 DEBUG (MainThread) [custom_components.chime_tts] - Chime TTS audio generated:
2024-05-13 18:13:29.755 DEBUG (MainThread) [custom_components.chime_tts] * audio_duration = 3.125
2024-05-13 18:13:29.755 DEBUG (MainThread) [custom_components.chime_tts] * local_path = "/media/sounds/temp/chime_tts/k37btgxj.mp3"
2024-05-13 18:13:29.755 DEBUG (MainThread) [custom_components.chime_tts] * public_path = None
2024-05-13 18:13:29.755 DEBUG (MainThread) [custom_components.chime_tts] * media_content_id = "media-source://media_source/local/sounds/temp/chime_tts/k37btgxj.mp3"
2024-05-13 18:13:29.755 DEBUG (MainThread) [custom_components.chime_tts] *** Pre-Playback Actions ***
2024-05-13 18:13:29.757 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - Increasing media_player.woonkamer's volume from 0.2 to 0.4
2024-05-13 18:13:29.769 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - Calling media_player.join service for 3 media_player entities...
2024-05-13 18:13:29.769 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - Joining 3 media_player entities:
2024-05-13 18:13:29.769 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - media_player.keuken
2024-05-13 18:13:29.769 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - media_player.woonkamer
2024-05-13 18:13:29.769 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - media_player.kantoor
2024-05-13 18:13:31.014 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] ...done
2024-05-13 18:13:31.016 DEBUG (MainThread) [custom_components.chime_tts] *** Chime TTS playback ***
2024-05-13 18:13:31.019 DEBUG (MainThread) [custom_components.chime_tts] Removing joined entity_ids: ['media_player.keuken', 'media_player.woonkamer', 'media_player.kantoor']
2024-05-13 18:13:31.019 DEBUG (MainThread) [custom_components.chime_tts] 1 Standard media player detected:
2024-05-13 18:13:31.019 DEBUG (MainThread) [custom_components.chime_tts] - media_player.keuken
2024-05-13 18:13:31.019 DEBUG (MainThread) [custom_components.chime_tts] Calling media_player.play_media with data:
2024-05-13 18:13:31.019 DEBUG (MainThread) [custom_components.chime_tts] - media_content_type: music
2024-05-13 18:13:31.019 DEBUG (MainThread) [custom_components.chime_tts] - media_content_id: media-source://media_source/local/sounds/temp/chime_tts/k37btgxj.mp3
2024-05-13 18:13:31.019 DEBUG (MainThread) [custom_components.chime_tts] - entity_id: ['media_player.keuken']
2024-05-13 18:13:31.021 DEBUG (MainThread) [custom_components.chime_tts] - Waiting 3.125s for audio playback to complete...
2024-05-13 18:13:34.150 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] - Waiting until 3 media_players aren't playing...
2024-05-13 18:13:34.751 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] ✔ media_player.keuken
2024-05-13 18:13:34.751 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] ✔ media_player.kantoor
2024-05-13 18:13:34.952 DEBUG (MainThread) [custom_components.chime_tts.helpers.media_player] ✔ media_player.woonkamer
2024-05-13 18:13:34.952 DEBUG (MainThread) [custom_components.chime_tts] *** Post-Playback Actions ***
2024-05-13 18:13:34.952 DEBUG (MainThread) [custom_components.chime_tts] - Calling media_player.unjoin service...
2024-05-13 18:13:34.952 DEBUG (MainThread) [custom_components.chime_tts] - media_player.unjoin: media_player.keuken
2024-05-13 18:13:36.416 DEBUG (MainThread) [custom_components.chime_tts] ...done
2024-05-13 18:13:36.416 DEBUG (MainThread) [custom_components.chime_tts] - media_player.unjoin: media_player.woonkamer
2024-05-13 18:13:38.099 DEBUG (MainThread) [custom_components.chime_tts] ...done
2024-05-13 18:13:38.099 DEBUG (MainThread) [custom_components.chime_tts] - media_player.unjoin: media_player.kantoor
2024-05-13 18:13:39.312 DEBUG (MainThread) [custom_components.chime_tts] ...done
2024-05-13 18:13:39.313 DEBUG (MainThread) [custom_components.chime_tts] ----- Chime TTS Say Completed in 9.9 s -----

HA-TB303 avatar May 13 '24 16:05 HA-TB303

I can confirm that I have been using v1.0.0 of Chime_tts with 3 Sonos speakers in a stereo pair and single (the rebranded Ikea Symfonisk ones) for a while and it's been quite reliable. I just tried out the latest beta version today before I read this but I couldn't get any output on my speakers so I reverted back to v1.0.0.

I'll play around with the beta and report back, but wanted to "chime" in to at least report that it had been working great with Sonos and I'm happy to help to get this working if I can.

nurse-curtis avatar May 15 '24 21:05 nurse-curtis

I'm not sure if this is helpful, but I can certainly take requests. I hope this is a Sonos-releated bug.

service: chime_tts.say
target:
  entity_id:
    - media_player.downstairs_sonos
    - media_player.upstairs_sonos
data:
  chime_path: bells
  message: Testing
  announce: true
  tts_platform: tts.piper
  join_players: false
  unjoin_players: false
  offset: 0
  final_delay: 0

Before chime_tts:

  • music playing on 'downstairs_sonos'
  • nothing playing on 'upstairs_sonos'

Call chime_tts.say with above parameters:

  • music volume on downstairs_sonos lowers
  • chime_tts plays on top of music on downstairs_sonos as expected
  • chime_tts does NOT play on upstairs_sonos
  • chime_tts repeats 2 times on downstairs_sonos (total of 3 plays)

chime_tts-1.log

service: chime_tts.say
target:
  entity_id:
    - media_player.downstairs_sonos
    - media_player.upstairs_sonos
data:
  chime_path: bells
  message: Testing
  announce: true
  tts_platform: tts.piper
  join_players: true
  unjoin_players: true
  offset: 0
  final_delay: 0

Before chime_tts:

  • music playing on 'downstairs_sonos'
  • nothing playing on 'upstairs_sonos'

Call chime_tts.say with above parameters:

  • music stops downstairs_sonos
  • chime_tts plays normally on upstairs_sonos
  • chime_tts does NOT play on downstairs_sonos
  • silence on both speakers after chime_tts completes, music does not resume on downstairs_sonos

chime_tts-2.log

nurse-curtis avatar May 16 '24 22:05 nurse-curtis