home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.56k stars 30.74k forks source link

Apple TV Integration Breaks on HomePod OS 18 #126154

Open Colorado4Wheeler opened 1 month ago

Colorado4Wheeler commented 1 month ago

The problem

After updating to HomePod OS 18, the devices show as "Off" in Home Assistant and cannot be turned on and will not answer TTS requests from "Browse Media". HomePod OS 17 devices still work fine. Reloading the integration or Home Assistant does not resolve the issue.

image

What version of Home Assistant Core has the issue?

core-2024.9.1

What was the last working version of Home Assistant Core?

core-2024.9.1

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Apple TV

Link to integration documentation on our website

https://www.home-assistant.io/integrations/apple_tv

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 month ago

Hey there @postlund, mind taking a look at this issue as it has been labeled with an integration (apple_tv) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `apple_tv` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign apple_tv` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


apple_tv documentation apple_tv source (message by IssueLinks)

abuchanan920 commented 1 month ago

I have encountered the same issue. It looks like removing and re-adding the device (along with typing the codes in again) worked for me

kersten-lohmeyer commented 1 month ago

Same for me. I used to call this script:

homepod_post_ist_da:
  alias: HomePod - Post ist da
  sequence:
  - service: media_player.media_pause
    metadata: {}
    data: {}
    target:
      device_id: e3f025cf4e757572b74afa9eb084a34f
  - service: media_player.volume_set
    metadata: {}
    data:
      volume_level: 0.7
    target:
      device_id: e3f025cf4e757572b74afa9eb084a34f
  - service: tts.google_translate_say
    data:
      cache: false
      entity_id: media_player.homepod_mini_wohnzimmer
      message: Die Post ist da! Die Post ist da!
      language: de
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - service: media_player.volume_set
    metadata: {}
    data:
      volume_level: 0.5
    target:
      device_id: e3f025cf4e757572b74afa9eb084a34f
  mode: single

I also removed my 2 HomePod minis and added them again. Once in a while it works for some reason but most of the time there's a 403 Forbidden error.

Bobettemcnugget commented 1 month ago

Hello!

I am having the same issue with homepods trying to setup TTS.

2024-09-19 11:25:38.255 WARNING (MainThread) [homeassistant.components.apple_tv] Connection lost to Apple TV "Salon (3)"
2024-09-19 11:25:48.269 ERROR (MainThread) [pyatv.protocols.airplay] Failed to se
t up remote control channelTraceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pyatv/support/http.py", line 464,
 in send_and_receive    await pending_request.event.wait()
  File "/usr/local/lib/python3.12/asyncio/locks.py", line 212, in wait
    await fut
asyncio.exceptions.CancelledErrorDuring handling of the above exception, another exception occurred:
Traceback (most recent call last):  File "/usr/local/lib/python3.12/site-packages/pyatv/support/http.py", line 463, in send_and_receive    async with async_timeout.timeout(timeout):
  File "/usr/local/lib/python3.12/site-packages/async_timeout/__init__.py", line 141, in __aexit__    self._do_exit(exc_type)
  File "/usr/local/lib/python3.12/site-packages/async_timeout/__init__.py", line 228, in _do_exit    raise asyncio.TimeoutErrorTimeoutError

  The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/airplay/__init__.py", line 347, in _connect_rc
    await session.connect()
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/airplay/ap2_session.py", line 71, in connect
    self.verifier = await verify_connection(self._credentials, self.connection)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/airplay/auth/__init__.py", line 105, in verify_connection    has_encryption_keys = await verifier.verify_credentials()
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/airplay/auth/hap_transient.py", line 49, in verify_credentials    await self.http.post("/pair-pin-start", headers=_AIRPLAY_HEADERS)  File "/usr/local/lib/python3.12/site-packages/pyatv/support/http.py", line 433,
 in post    return await self.send_and_receive(           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyatv/support/http.py", line 475, in send_and_receive    raise TimeoutError(f"no response to {method} {uri} ({protocol})") from exTimeoutError: no response to POST /pair-pin-start (HTTP/1.1)

Here's what I found in the logs. I've tried adding/readding to no avail. The homepod in question is called "Salon (3)"

Not super familiar with any of this, but looks like /pair-pin-start is timing out. Looks auth related.

metawops commented 1 month ago

I'm having similar problems with all my original HomePods and HomePods mini.

Re-adding the HomePod to HA seems to solve this (for now, tested with one of my 8 HomePods).

fabian1512 commented 1 month ago

here is a solution: https://community.home-assistant.io/t/how-to-edit-remove-an-area/287453/4

deleting an re-adding my HomePods worked for me as well.

kersten-lohmeyer commented 1 month ago

here is a solution: https://community.home-assistant.io/t/how-to-edit-remove-an-area/287453/4

deleting an re-adding my HomePods worked for me as well.

No, it doesn't, at least not for me. HomePods stay either silent or there's an 403 Forbidden error. Very very rarely it works. Also what's that link?

Saharok14 commented 1 month ago

re-adding into the HA worked. You don’t need to reset your homepod and re-add it to the Homekit. Just remove it from the HA and re-add again. Worked for me.

kersten-lohmeyer commented 1 month ago

Nice, that it works for some of you but using this script it does not work but did before iOS 18:

homepod_post_ist_da:
  alias: HomePod - Post ist da
  sequence:
  - service: media_player.media_pause
    metadata: {}
    data: {}
    target:
      device_id: e3f025cf4e757572b74afa9eb084a34f
  - service: media_player.volume_set
    metadata: {}
    data:
      volume_level: 0.7
    target:
      device_id: e3f025cf4e757572b74afa9eb084a34f
  - service: tts.google_translate_say
    data:
      cache: false
      entity_id: media_player.homepod_mini_wohnzimmer
      message: Die Post ist da! Die Post ist da!
      language: de
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - service: media_player.volume_set
    metadata: {}
    data:
      volume_level: 0.5
    target:
      device_id: e3f025cf4e757572b74afa9eb084a34f
  mode: single

Most of the time it simply does not work, script does not produce any errors but the HomePod mini remains silent.

Colorado4Wheeler commented 1 month ago

@kersten-lohmeyer have you tried it without using device ID's and using the entity ID instead? This is exactly the type of issue/possible resolution/situation that makes using device ID's problematic since they can and will change under these circumstances.

kersten-lohmeyer commented 1 month ago

@kersten-lohmeyer have you tried it without using device ID's and using the entity ID instead? This is exactly the type of issue/possible resolution/situation that makes using device ID's problematic since they can and will change under these circumstances.

No I haven't but I did update the device ids when I re-added my HomePod.

TesLocker commented 3 weeks ago

I’m experiencing the same, even though my automations all use entity and not device IDs.

odegraciajr commented 2 weeks ago

I have the same issue, re-adding works for a while, then once the homepod gets restarted(i guess) it starts should offline again can can access it.

Beertje135 commented 1 week ago

Same problem here. Re-addaing works for Some time but problem Comes back

VeniceNerd commented 6 days ago

here is a solution: https://community.home-assistant.io/t/how-to-edit-remove-an-area/287453/4

deleting an re-adding my HomePods worked for me as well.

I’m sorry but I can’t figure out how to delete a HomePod from my home assistant. I don’t see a “delete” option when I’m on the device page.

Can anyone point me in the right direction?

fabian1512 commented 6 days ago

Here you are:

Bildschirmfoto 2024-11-03 um 18 29 17
sddgit commented 6 days ago

Whenever this happens to me, I just go to the Apple TV integration page, choose the 3 dots menu next to the HomePod in question and select Reload. Comes back within a few seconds.

kersten-lohmeyer commented 5 days ago

I removed my HomePod mini now and readded it. TTS works at the moment. Let's see for how long.