Apple TV Integration reinstallation because of TTS issues

Hi all

I have a couple of home pods, which I use for TTS. However, for a few months, it is not working anymore and produces a very strange error message, which you find here.

Fehler beim Aufrufen des Dients media_player/play_media. HTTPConnectionPool(host='192.168.5.78, port=8123): Max retries exceeded with url: /api/tts_proxy/90991d5479fe2eb1c7130f11b17faf424cb3f3c_de-ch_9592887e9_cloud.mp3 (Caused by NewConnectionError*<urllib3.connection.HTTPConnection object at
0x7f4419db50>: Failed to establish a new connection: [Errno 113] Host is unreachable))

I think the biggest issue is likely the IP address here, which has nothing to do with either my Home Assistant installation nor with the HomePods. I wanted to reinstalled the Apple TV integration by deleting all the HomePods and Apple TVs and restarted Home Assistant. However, this did not work and still the same error message is dropping. So I decided to install Home Assistant from scratch and tried Apple TV integration with TTS and It worked again. However, when I am restoring the old back up the same error message drops again, I experienced the same issues, even if I play MP3s, however, radio streaming works on the HomePods.

So my question is, is there a method to reinstall just the Apple TV integration, which deletes the wrong settings? or to leave out the Apple TV integration, while restoring from the back up.

I am using a raspberry pie 4 for Home Assistant with a HASS installation and an ssd.

thanks

hemy

Anybody an idea?
Thanks
Hemy

I was trying it again today. I deleted all apple tvs and homepod minis and restarted my raspberry pi 4. Without success the same error drops. So it seams that the Apple TV integration is not deleted here. Any advice would be helpful. Maybe @postlund can help here?

Can you please post more of the error message? I would expect there to be an exception somewhere. Also, are you using any firewall, VLANs or such? Is the IP the actual IP of your home Assistant machine?

1 Like

Thanks for the reply. I am not using a firewall or VLAN. The IP address is not the one of Ha. Here is the detailed error.

Logger: homeassistant.components.script.patrick_home
Source: helpers/script.py:485
Integration: Skript (documentation, issues)
First occurred: 15:22:53 (3 occurrences)
Last logged: 20:01:08

patrick_home: Error executing script. Unexpected error for call_service at pos 1: HTTPConnectionPool(host='192.168.5.78', port=8123): Max retries exceeded with url: /api/tts_proxy/11eed11b5910a1c7857e065d619963865c385ec4_de-ch_e09b5a0968_cloud.audiooutput.mp3 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f5db3c440>: Failed to establish a new connection: [Errno 113] Host is unreachable'))
patrick_home: Error executing script. Unexpected error for call_service at pos 1: HTTPConnectionPool(host='192.168.5.78', port=8123): Max retries exceeded with url: /api/tts_proxy/11eed11b5910a1c7857e065d619963865c385ec4_de-ch_e09b5a0968_cloud.audiooutput.mp3 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f3f7a1070>: Failed to establish a new connection: [Errno 113] Host is unreachable'))
patrick_home: Error executing script. Unexpected error for call_service at pos 1: HTTPConnectionPool(host='192.168.5.78', port=8123): Max retries exceeded with url: /api/tts_proxy/11eed11b5910a1c7857e065d619963865c385ec4_de-ch_e09b5a0968_cloud.audiooutput.mp3 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7efb9be5a0>: Failed to establish a new connection: [Errno 113] Host is unreachable'))
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/raop/audio_source.py", line 597, in open
    stream_generator = await loop.run_in_executor(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/miniaudio.py", line 1268, in stream_any
    raise DecodeError("failed to init decoder", result)
miniaudio.DecodeError: ('failed to init decoder', -17)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 485, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 723, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 685, in _async_run_long_action
    return long_task.result()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tts/legacy.py", line 148, in async_say_handle
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/apple_tv/media_player.py", line 304, in async_play_media
    await self.atv.stream.stream_file(media_id)
  File "/usr/local/lib/python3.12/site-packages/pyatv/core/facade.py", line 371, in stream_file
    await self.relay("stream_file")(
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/raop/__init__.py", line 360, in stream_file
    audio_file = await open_source(
                 ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/raop/audio_source.py", line 729, in open_source
    return await InternetSource.open(source, sample_rate, channels, sample_size)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/raop/audio_source.py", line 610, in open
    raise ProtocolError(source.error_message) from ex
pyatv.exceptions.ProtocolError: HTTPConnectionPool(host='192.168.5.78', port=8123): Max retries exceeded with url: /api/tts_proxy/11eed11b5910a1c7857e065d619963865c385ec4_de-ch_e09b5a0968_cloud.audiooutput.mp3 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f5db3c440>: Failed to establish a new connection: [Errno 113] Host is unreachable'))

any idea @postlund
Thanks
Patrick

192.168.5.78 isn’t the IP of your home Assistant instance?

No this is not the IP of my home assistant, which is strange. Even if I delete all device (Apple TVs and HomePod Minis) this IP remains the same. Is there a way to reset the Integration?

Interestingly, also wenn I reinstall HA and restore from backup the same issue and error occurs. So to solve this issue, it would require a full installation of HA and doing all settings/automations again, without restoring from backup, just because one integration is broken. Any idea how I can bypass this issue? Thanks!

is there a manual way to change the IP address?

OK I simply changed the IP address of my HA Raspberry PI. And it work again…
:stuck_out_tongue_winking_eye:

Still no idea where this is coming from. I am glad it works again.

I think I get similar issue recently with TTS. Do you know what was the problem?