Hi Everyone,
I really love Chime TTS especially the announce function which I really want to use. But after an initial succes of setting up Chime TTS on my system of 4 Sonos one and 7 AirPort Express airplay 2 devices. After a weekend away from the house trouble started. Only one of the sonos devices would still play the Chime TTS script that I made and none of the airplay devices would work.
First I found out that the Sonos players were getting an IP ban due to expired URL tokens and I found the workaround for that in this topic https://github.com/home-assistant/core/issues/88714#issuecomment-2692173073
Now I am wrecking my head over how to get the chime_tts.say function to start working again on my airplay 2 devices. I can get a direct google translate TTS and also a chime_tts.say_url function to work. But if I want to call chime_tts.say then the below connection lost error logs appear and the sound does not play, were it did play perfectly before. Below is the script that I use, it works now on the Sonos players but not on the airport express airplay2 devices:
alias: Original Chime TTS Test
sequence:
- action: chime_tts.say
data:
tts_platform: google_translate
message: Test message
chime_path: bright
language: nl
announce: true
volume_level: 0.5
target:
entity_id: media_player.dynaudio_airplay
mode: single
I get the following errors in the log:
This error originated from a custom integration.
Logger: custom_components.chime_tts.helpers.media_player_helper
Source: custom_components/chime_tts/helpers/media_player_helper.py:569
integration: Chime TTS (documentation, issues)
First occurred: 3 March 2025 at 19:12:46 (7 occurrences)
Last logged: 19:26:04
Unable to set media_player.dynaudio_airplay's volume to 0.33: connection was lost
Unable to set media_player.dynaudio_airplay's volume to 0.3299999999999999: connection was lost
Unable to set media_player.dynaudio_airplay's volume to 0.15: connection was lost
Unable to set media_player.dynaudio_airplay's volume to 0.18999999999999997: connection was lost
Unable to set media_player.dynaudio_airplay's volume to 0.32000000000000006: connection was lost
Logger: homeassistant.core
Source: core.py:2814
First occurred: 3 March 2025 at 19:12:46 (7 occurrences)
Last logged: 19:26:04
Error executing service: <ServiceCall media_player.play_media (c:01JNEQBQ9NNNP786Y024NRYWQS): entity_id=['media_player.dynaudio_airplay'], announce=True, extra=, media_type=music, media_id=media-source://media_source/local/sounds/temp/chime_tts/b2d01a6ac0c7319db367792cd8875c29.mp3>
Error executing service: <ServiceCall media_player.play_media (c:01JNGQ23PG9Y5WT64AKAKH3BAM): entity_id=['media_player.dynaudio_airplay'], announce=True, extra=, media_type=music, media_id=media-source://media_source/local/sounds/temp/chime_tts/0aa07b8a4593a0ae94c2eaae8a0bb979.mp3>
Error executing service: <ServiceCall media_player.play_media (c:01JNH6BF1XYZS1BFPNC44BQ4NM): entity_id=['media_player.dynaudio_airplay'], announce=True, extra=, media_type=music, media_id=media-source://media_source/local/sounds/temp/chime_tts/6c91772fa8e1cb0fc9f3f1470588b5fe.mp3>
Error executing service: <ServiceCall media_player.play_media (c:01JNH6DA3XH642QK6N7JZFD450): entity_id=['media_player.dynaudio_airplay'], announce=True, extra=, media_type=music, media_id=media-source://media_source/local/sounds/temp/chime_tts/b92c43f566fd1fea809167a53573345f.mp3>
Error executing service: <ServiceCall media_player.play_media (c:01JNH6GQBF7HWFWYMS8R4MG870): entity_id=['media_player.dynaudio_airplay'], announce=True, extra=, media_type=music, media_id=media-source://media_source/local/sounds/temp/chime_tts/fa8c3bb141ce06dca17ce4d47d65850c.mp3>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/core.py", line 2814, in _run_service_call_catch_exceptions
await coro_or_task
File "/usr/src/homeassistant/homeassistant/core.py", line 2837, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
hass, entity, func, data, call.context
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/apple_tv/media_player.py", line 345, in async_play_media
await self.atv.stream.stream_file(media_id)
File "/usr/local/lib/python3.13/site-packages/pyatv/core/facade.py", line 374, in stream_file
await self.relay("stream_file")(
...<4 lines>...
)
File "/usr/local/lib/python3.13/site-packages/pyatv/protocols/raop/__init__.py", line 356, in stream_file
await client.initialize(self.core.service.properties)
File "/usr/local/lib/python3.13/site-packages/pyatv/protocols/raop/stream_client.py", line 338, in initialize
await self._protocol.setup(self.timing_server.port, self.control_client.port)
File "/usr/local/lib/python3.13/site-packages/pyatv/protocols/raop/protocols/airplayv2.py", line 109, in setup
await self._setup_base(timing_server_port)
File "/usr/local/lib/python3.13/site-packages/pyatv/protocols/raop/protocols/airplayv2.py", line 56, in _setup_base
setup_resp = await self.rtsp.setup(
^^^^^^^^^^^^^^^^^^^^^^
...<17 lines>...
)
^
File "/usr/local/lib/python3.13/site-packages/pyatv/support/rtsp.py", line 177, in setup
return await self.exchange("SETUP", headers=headers, body=body)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/pyatv/support/rtsp.py", line 294, in exchange
resp = await self.connection.send_and_receive(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<8 lines>...
)
^
File "/usr/local/lib/python3.13/site-packages/pyatv/support/http.py", line 467, in send_and_receive
raise exceptions.ConnectionLostError("connection was lost")
pyatv.exceptions.ConnectionLostError: connection was lost
I have made debug log too, but it is very long and do not see how I ca post it.
Would anyone be able to help me get this going again? It seems like there is an issue with being able to play the local temporary file because any other media does play, and also I can play a local file from the chime tts folder in the /media/sounds/temp/chime_tts/ folder. But the file that I find there strongly enough is an old TTS file that was created when the script was still working more than a week ago.
I really love the announce feature and how it even works over external audio played via airplay by another source, which is why it would love it to start working again!