Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apple Integration Broken Following iOS 16.2 Devices Update #84233

Closed
Sooty70 opened this issue Dec 19, 2022 · 19 comments
Closed

Apple Integration Broken Following iOS 16.2 Devices Update #84233

Sooty70 opened this issue Dec 19, 2022 · 19 comments

Comments

@Sooty70
Copy link

Sooty70 commented Dec 19, 2022

The problem

Following Apple's recent release of 16.2 devices from Home Assistant take a long time (hours) to update in the Apple Home App. The slow process repeats itself each time you add a new device or there is a restart of HA.

Interestingly the import of entities into Home Assistant from HomeKit Controller is working fine, however, the AppleTV integration is definitely broken.

image

And when you open the config for each device you get the following;

image

I've tried rebooting all the apple devices and reloading the integration with no change...

What version of Home Assistant Core has the issue?

Home Assistant 2022.12.7 Supervisor 2022.11.2 Operating System 9.4 Frontend 20221213.1 - latest

What was the last working version of Home Assistant Core?

Home Assistant 2022.12.7 Supervisor 2022.11.2 Operating System 9.4 Frontend 20221213.1 - latest

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?

Logger: homeassistant.components.apple_tv
Source: components/apple_tv/__init__.py:323 
Integration: Apple TV (documentation, issues) 
First occurred: 10:00:21 (393 occurrences) 
Last logged: 11:52:09

Failed to connect
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/mrp/protocol.py", line 274, in _receive
    await semaphore.acquire()
  File "/usr/local/lib/python3.10/asyncio/locks.py", line 390, 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 222, in connect_once
    await self._connect(conf, raise_missing_credentials)
  File "/usr/src/homeassistant/homeassistant/components/apple_tv/__init__.py", line 323, in _connect
    self.atv = await connect(conf, self.hass.loop, session=session)
  File "/usr/local/lib/python3.10/site-packages/pyatv/__init__.py", line 135, in connect
    await atv.connect()
  File "/usr/local/lib/python3.10/site-packages/pyatv/core/facade.py", line 575, in connect
    if await setup_data.connect():
  File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/mrp/__init__.py", line 941, in _connect
    await protocol.start()
  File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/mrp/protocol.py", line 142, in start
    self.device_info = await self.send_and_receive(
  File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/mrp/protocol.py", line 261, in send_and_receive
    return await self._receive(identifier, timeout)
  File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/mrp/protocol.py", line 273, in _receive
    async with async_timeout.timeout(timeout):
  File "/usr/local/lib/python3.10/site-packages/async_timeout/__init__.py", line 129, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.10/site-packages/async_timeout/__init__.py", line 212, in _do_exit
    raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError

Additional information

No response

@home-assistant
Copy link

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 Change the title of 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.

(message by CodeOwnersMention)


apple_tv documentation
apple_tv source
(message by IssueLinks)

@blockarchitech
Copy link

blockarchitech commented Dec 21, 2022

Screenshot 2022-12-21 at 12 20 23 PM

Same issue. TV 4K 1st Gen

Update: Relentlessly being asked to enter an AirPlay code about every 10 minutes.PXL_20221221_172433552.jpg

@Sooty70
Copy link
Author

Sooty70 commented Dec 24, 2022

Further sharing... I've removed the devices and tried to reconfigure the integration as it discovers the devices. Here are the screen scrapes;
image
image
image
image
image
image

Same result when trying to add the HomePod's too...

@blockarchitech
Copy link

blockarchitech commented Dec 24, 2022 via email

@molant
Copy link

molant commented Jan 12, 2023

Same issue here since the 16.2 update 😭

image

@biggeeus
Copy link

I didn't upgrade to 16.2 becuase of this issue but a week ago decided to upgrade to 16.2 and touch wood I have not encountered this issue. I'm not sure what is different in my setup but I am running HA in a docker container with host networking.

@kernelkraut
Copy link

My three Apple TV's auto updated sometime in the last week and since then I've noticed that there is no linger a "Standby" power state reported. Since I rely on the state to turn on/off an old stereo, that no longer works.

All other states, media info, apps etc are all being updated correctly in the states information of the entity so thats still working nicely.

I am using the ATV beta add on (Hacs) since the native plugin hasn't worked for me since tvOS15.

@Sooty70
Copy link
Author

Sooty70 commented Jan 16, 2023

Thanks @kernelkraut - I will take a look at the ATV beta as I just can’t get my ATV or HomePods to pair with HA anymore. I’ve also had to completely wipe all my HomeKit data on the Apple cloud (via downloaded profile) and rebuild just to get a working HA Bridge back into HomeKit. Seems Apple have screwed up big time with the implementation of this Architectural update.

@blockarchitech
Copy link

blockarchitech commented Jan 16, 2023 via email

@pickett
Copy link

pickett commented Jan 20, 2023

@postlund @bdraco are either of you still maintaining this integration by chance?

@vitaliy-kozlov
Copy link

Hi, Having the same issue!! No response after updating to 16.2. Deleting and repairing hub with 100 + Accessories is not working, after first reboot all devices became not responsible again! damn this is so bad! What can we do with this? Is there any working solution? I cant take a hours of mi life to fix this. All my devices connected to homekit using home assistant.! This is fail of century! Also Homebridge bridge is working without any issues.

@pickett
Copy link

pickett commented Jan 21, 2023

Does the Apple TV HACS integration work better @Sooty70?

@Sooty70
Copy link
Author

Sooty70 commented Jan 22, 2023

Does the Apple TV HACS integration work better @Sooty70?

I don’t see an Apple TV HACS integration (I think the original made it into HA Core). Thus sadly still can’t get my TV or HomePods into HA. ☹️

@postlund
Copy link
Contributor

Does the Apple TV HACS integration work better @Sooty70?

I don’t see an Apple TV HACS integration (I think the original made it into HA Core). Thus sadly still can’t get my TV or HomePods into HA. ☹️

The beta is really old, don't use that. Go into the Home app and make sure you change access settings for HomePods to everyone on the same network. HomePod works for me so it's likely that reason.

@Sooty70
Copy link
Author

Sooty70 commented Jan 22, 2023

Does the Apple TV HACS integration work better @Sooty70?

I don’t see an Apple TV HACS integration (I think the original made it into HA Core). Thus sadly still can’t get my TV or HomePods into HA. ☹️

The beta is really old, don't use that. Go into the Home app and make sure you change access settings for HomePods to everyone on the same network. HomePod works for me so it's likely that reason.

Thankyou @postlund - pairing working now!

@pickett
Copy link

pickett commented Jan 22, 2023

@postlund I don't know if that solves the issue I'm seeing - once I changed AirPlay access settings all I get is constant disconnects and reconnects. Maybe a separate issue but certainly related to 16.2

image

Happy to provide better debugging and more in-depth logs if you're able to look into it.

@pickett
Copy link

pickett commented Jan 23, 2023

For some more details, I am on 16.2 Apple TV, HA 2023.1.4. The Apple TV is connected via Ethernet and set to allow connections from everyone using the Apple TV’s internal menu for Airplay & HomeKit.

To start I deleted the device and integration, then went through the process of re-adding via IP address entering 3 different airplay passcode prompts.It works fine until I put it to sleep. Then, this happens:

`Logger: homeassistant.components.apple_tv
Source: components/apple_tv/init.py:324
Integration: Apple TV (documentation, issues)
First occurred: 7:23:30 PM (3 occurrences)
Last logged: 7:31:04 PM

Failed to connect
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/apple_tv/init.py", line 222, in connect_once
await self._connect(conf, raise_missing_credentials)
File "/usr/src/homeassistant/homeassistant/components/apple_tv/init.py", line 324, in _connect
self.atv = await connect(conf, self.hass.loop, session=session)
File "/usr/local/lib/python3.10/site-packages/pyatv/init.py", line 135, in connect
await atv.connect()
File "/usr/local/lib/python3.10/site-packages/pyatv/core/facade.py", line 575, in connect
if await setup_data.connect():
File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/init.py", line 411, in _connect
await api.connect()
File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/api.py", line 121, in connect
await self._protocol.start()
File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/protocol.py", line 101, in start
await self.connection.connect()
File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/companion/connection.py", line 80, in connect
await self.loop.create_connection(lambda: self, self.host, self.port)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1064, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1049, in create_connection
sock = await self._connect_sock(
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 960, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 500, in sock_connect
return await fut
File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 535, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.7.241', 49153)`

As well as this error:

`Logger: pyatv.protocols.airplay
Source: /usr/local/lib/python3.10/site-packages/pyatv/protocols/airplay/init.py:267
First occurred: 7:23:27 PM (3 occurrences)
Last logged: 7:31:01 PM

Failed to set up remote control channel
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/airplay/init.py", line 258, in _connect_rc
await control.start(str(core.config.address), control_port, credentials)
File "/usr/local/lib/python3.10/site-packages/pyatv/protocols/airplay/remote_control.py", line 55, in start
self.connection = await http_connect(address, control_port)
File "/usr/local/lib/python3.10/site-packages/pyatv/support/http.py", line 558, in http_connect
_, connection = await loop.create_connection(HttpConnection, address, port)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1064, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1049, in create_connection
sock = await self._connect_sock(
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 960, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 500, in sock_connect
return await fut
File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 535, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.7.241', 7000)`

And these warnings:

`Logger: homeassistant.components.apple_tv
Source: components/apple_tv/init.py:169
Integration: Apple TV (documentation, issues)
First occurred: 7:18:50 PM (11 occurrences)
Last logged: 7:33:28 PM

Connection lost to Apple TV "Basement (2)" `

Once I then turn it back on again, it will not re-initialize state and will show as “Idle” even with media playing.

Restarting home assistant WILL properly initialize the state of the Apple TV.

@postlund let me know if I can do more digging for you. And if I’m conflating issues here, let me know and I can copy this over to another issue and delete my comments so people aren’t confused.

@molant
Copy link

molant commented Jan 26, 2023

I updated to 16.3 yesterday and the integration started working again without doing anything 🎉

@Sooty70
Copy link
Author

Sooty70 commented Jan 26, 2023

Media devices setting change to allow everyone to access fixed issue.

@Sooty70 Sooty70 closed this as completed Jan 26, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants