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
71.9k stars 30.12k forks source link

HomePod constantly disconnects which require manual "reload" of Integration #114836

Open edmondss opened 6 months ago

edmondss commented 6 months ago

The problem

Homepods constantly disconnects which require manual reloading of Apple TV integration .

Sometimes HA detects the issue and ask me to reload the integration. Sometimes it doesn't and when I notice my automation doesn't work as the device went completely to OFF (instead of standby). Cannot wake up the device unless manual reloading the integration.

What version of Home Assistant Core has the issue?

core-2024.3.3

What was the last working version of Home Assistant Core?

No response

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 6 months 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)

nmiller-engineering commented 6 months ago

Unfortunately I ran into the same issue!

Jaco1990 commented 5 months ago

I have the same issue but with an Apple TV 4K

edmondss commented 5 months ago

I have the same issue but with an Apple TV 4K

Yes, sometimes it happens to my ATV too.

echavet commented 5 months ago

Same for me with apple TV. I always have to manually reconfigure the integration.

edmondss commented 5 months ago

Even if the devices is NOT disconnected, it changed to OFF even it's actually in standby. You have to reload integration to make it work.

scottshanafelt commented 5 months ago

Experiencing the same on multiple systems all using AppleTV gen 4's. Seems to occur often when AppleTV is rebooted or goes offline. Integration has to be reloaded to resurrect.

jum0n commented 5 months ago

I had the same issue with my AppleTV. Reloaded integration and its working again. Its been very stable until just recently, not sure whats changed.

F-HALD commented 4 months ago

Same problem here. I have to reload the integration at least daily. Is it possible to reload an integration from an automation? I know that it is a work-around, but what is the alternative?

edmondss commented 4 months ago

Appreciate if there's some feedback from integration owner. Thanks.

bobbergen commented 4 months ago

I am having the same issue.

cpressland commented 4 months ago

For now I've mitigated this with the following automation:

alias: Shed - Reload HomePod Config
description: ""
trigger:
  - platform: device
    type: turned_off
    device_id: af26fc2929912a7ed13c45ad61e3978b
    entity_id: 324f4059551f8f1247ddd097fdd1592e
    domain: remote
condition: []
action:
  - service: homeassistant.reload_config_entry
    metadata: {}
    data: {}
    target:
      device_id: af26fc2929912a7ed13c45ad61e3978b
mode: single
bobbergen commented 4 months ago

I came up with the same workaround automation two days ago, I have 16 HomePod Minis and 7 AppleTVs so it added a few automations to my stable.

bobbergen commented 4 months ago

`alias: Reload-AppleTV-Living Room description: "" trigger:

zipzagster commented 4 months ago

I have the disconnection problem with ATV. The state becomes stale. Reloading sometimes doesn't refresh the state

tomdh76 commented 4 months ago

same issue, i have to reload the integration almost daily

Royal911 commented 3 months ago

Same here

KapUttyy commented 1 month ago

Same here…

misaligar commented 1 month ago

Same issue. The automation workaround from @cpressland seems to be working for now.

Gybrsh commented 2 weeks ago

I suspect the AppleTV integration, at least for HomePods, is broken after the update along with iOS 18. It was unstable before, now it's completely dead.

I've tried restarting HomePods, restarting Apple integration, devices and restarting HA. I've connected Apple Music directly to HomePods and played music, and tried streaming from mobile. I have pairs in stereo but tried all this without grouping.

But no... state forever off.

Has anyone experienced the same, or is it just me?

mattsch commented 2 weeks ago

@Gybrsh I had the same problem at first. Deleting the HomePods and re-adding did the trick for me.

Gybrsh commented 2 weeks ago

Damn! That worked @mattsch. I should have tried that first, haha :D Thanks!!

edmondss commented 2 weeks ago

Damn! That worked @mattsch. I should have tried that first, haha :D Thanks!!

May I ask, after upgrading to iOS 18, do they still have the same problem that HomePod/ ATV went off or unavailable which requires regular manual reload the integration

misaligar commented 2 weeks ago

@edmondss I have iOS 18. I will monitor and report back. I will know the issue persists if my automation to reload the integration triggers again.

edmondss commented 1 week ago

@edmondss I have iOS 18. I will monitor and report back. I will know the issue persists if my automation to reload the integration triggers again.

Thank you. Appreciated.

misaligar commented 1 week ago

@edmondss Unfortunately, I can report that the issue persists. My automation for reload triggered yesterday. I don't know if it helps but I found the following error in the logs:

Failed to connect

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/mrp/protocol.py", line 275, in _receive
    await semaphore.acquire()
  File "/usr/local/lib/python3.12/asyncio/locks.py", line 386, in acquire
    await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/apple_tv/__init__.py", line 282, in connect_once
    await self._connect_once(raise_missing_credentials)
  File "/usr/src/homeassistant/homeassistant/components/apple_tv/__init__.py", line 267, in _connect_once
    await self._connect(conf, raise_missing_credentials)
  File "/usr/src/homeassistant/homeassistant/components/apple_tv/__init__.py", line 387, in _connect
    self.atv = await connect(conf, self.hass.loop, session=session)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyatv/__init__.py", line 155, in connect
    await atv.connect()
  File "/usr/local/lib/python3.12/site-packages/pyatv/core/facade.py", line 723, in connect
    if await setup_data.connect():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/mrp/__init__.py", line 1097, in _connect
    await protocol.start()
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/mrp/protocol.py", line 146, in start
    self.device_info = await self.send_and_receive(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/mrp/protocol.py", line 262, in send_and_receive
    return await self._receive(identifier, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/mrp/protocol.py", line 274, in _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.TimeoutError
TimeoutError
edmondss commented 1 week ago

@edmondss Unfortunately, I can report that the issue persists. My automation for reload triggered yesterday. I don't know if it helps but I found the following error in the logs:

Failed to connect

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/mrp/protocol.py", line 275, in _receive
    await semaphore.acquire()
  File "/usr/local/lib/python3.12/asyncio/locks.py", line 386, in acquire
    await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/apple_tv/__init__.py", line 282, in connect_once
    await self._connect_once(raise_missing_credentials)
  File "/usr/src/homeassistant/homeassistant/components/apple_tv/__init__.py", line 267, in _connect_once
    await self._connect(conf, raise_missing_credentials)
  File "/usr/src/homeassistant/homeassistant/components/apple_tv/__init__.py", line 387, in _connect
    self.atv = await connect(conf, self.hass.loop, session=session)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyatv/__init__.py", line 155, in connect
    await atv.connect()
  File "/usr/local/lib/python3.12/site-packages/pyatv/core/facade.py", line 723, in connect
    if await setup_data.connect():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/mrp/__init__.py", line 1097, in _connect
    await protocol.start()
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/mrp/protocol.py", line 146, in start
    self.device_info = await self.send_and_receive(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/mrp/protocol.py", line 262, in send_and_receive
    return await self._receive(identifier, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/mrp/protocol.py", line 274, in _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.TimeoutError
TimeoutError

Thanks. I hate to ask, will this ever be fixed?