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 TV integration constantly requires reconfiguration after tvOS 17 install #100572

Open
mikesalz opened this issue Sep 19, 2023 · 57 comments
Open

Comments

@mikesalz
Copy link

The problem

Upgraded my 3 Apple TVs to tvOS 17 today, and now they require constant reconfiguration.

What version of Home Assistant Core has the issue?

core-2023.9.2

What was the last working version of Home Assistant Core?

core-2023.9.2

What type of installation are you running?

Home Assistant Container

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

Not sure yet, but this might only manifest after restarting the Apple TV.

@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 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.

(message by CodeOwnersMention)


apple_tv documentation
apple_tv source
(message by IssueLinks)

@postlund
Copy link
Contributor

Check that AirPlay permissions is set to "Everyone on the same network", they like to change that on updates.

@mikesalz
Copy link
Author

@postlund Thanks for the suggestion. Unfortunately that did not help. The setting was already enabled. I tried disabling and then re-enabling it just to be certain. I then reconfigured the Apple TV in Home Assistant. It worked until I restarted the Apple TV, just like before. I even tried completely removing the Apple TV and re-adding it. Same. It works until you restart. Is tvOS 17 working for you, even after restarts?

@postlund
Copy link
Contributor

That sounds a bit strange to me. I haven't updated yet, my schedule right now is pretty insane so I haven't had the time. I will try that soon though and see what happens. Can you check the logs? Should be something there.

@mikesalz
Copy link
Author

mikesalz commented Sep 19, 2023

home-assistant_2023-09-19T17-55-37.566Z.log
I enabled debug logging and then reconfigured a couple of Apple TVs. Then I restarted them a couple of times and was asked to reconfigure again. Attached is the log. Please let me know if I can do anything else to help debug!

@mikesalz
Copy link
Author

mikesalz commented Sep 19, 2023

@postlund I made one other observation. After the integration fails and asks for reconfiguration - If I restart HA the integration works again until the next Apple TV restart.

@kwithus
Copy link

kwithus commented Sep 21, 2023

I have the same problem

@mikesalz
Copy link
Author

Hi @postlund - Just curious if you have had a chance to look into this yet? Please let me know what else I can do to help debug. Thanks!

@postlund
Copy link
Contributor

Hi @postlund - Just curious if you have had a chance to look into this yet? Please let me know what else I can do to help debug. Thanks!

Not yet, probably tomorrow.

@BarneyHam
Copy link

Just to say - really appreciate this being looked at - same thing happening for me

@poudenes
Copy link

Hi all,

I found out when I reboot my AppleTV the connection is lost and have to pair the AppleTV again in HA

@tetragram55
Copy link

I have the same problem but on v16

@mikesalz
Copy link
Author

mikesalz commented Oct 6, 2023

Hi @postlund - Just curious if you have had a chance to look into this yet? Please let me know what else I can do to help debug. Thanks!

Not yet, probably tomorrow.

@postlund With fingers crossed, I installed 2023.10.1 today hoping that this issue would be resolved. But unfortunately it is not. I guess you've been too busy to look into it yet. Again, please let me know what I can do to help. I appreciate it!

@kwithus
Copy link

kwithus commented Oct 7, 2023

Funny enough my Apple TV integration is currently working again, without any changes on my side. I now updated to 10.1 and it is still working

@muhlba91
Copy link

muhlba91 commented Oct 7, 2023

mine cannot even find my apple tv. with tvos 16 this was working; then i removed the integration due to the upgrade to tvos 17 beta; i try since weeks to add it again with no success (airplay is enabled for everyone).

@mikesalz
Copy link
Author

Unfortunately this integration has become nearly useless. Every time I restart one of my Apple TVs - which is daily - the integration fails. Reloading the integration does not work. But restarting HA does fix the issue. @postlund Is this something you are looking into? Haven't heard anything from you in a couple of weeks?

@kwithus
Copy link

kwithus commented Oct 11, 2023

yes, it’s strange. sometimes it works sometimes not. although it sometimes helps to restart HA, it also sometimes starts to work again out of nowhere and also it stops out of nowhere

@poudenes
Copy link

I don't have this issue anymore. Update ha multiple times and reboot but everything is working here...

@kwithus
Copy link

kwithus commented Oct 11, 2023

maybe we should add info about versions of ATV and TVOS
i have ATV Gen 3 and TvOS 17.0 and I have the problems

@mikesalz
Copy link
Author

Good call, @kwithus!

I have three Apple TVs. Two are Apple TV 4K (2nd generation) and one is Apple TV 4K (3rd generation). All not working correctly on TVOS 17. And all did work correctly on TVOS 16.x.

@muhlba91
Copy link

i have an ATV 4k (3rd gen) and tvOS 17. with tvOS 16 all worked without any issues - now i can't even pair it = the integration doesn't find the ATV at all.

@poudenes
Copy link

Apple TV 4
Firmware: 17.0

Home Assistant 2023.10.1
Supervisor 2023.10.0
Operating System 10.5
Frontend 20231005.0 - latest

No issues

@postlund
Copy link
Contributor

I don't really see this behavior myself that often (it happens every now and then, but not very often as said). I believe one issue is that sometimes connecting to the device fails because of a timeout for some reason. If this happens during connect, it will currently be re-raised as an AuthenticationError and Home Assistant will trigger a reconfig because of that. The idea is just to let that exception pass-through, which instead will just trigger an error and allow the integration to make another connection attempt. I opened an issue about this here postlund/pyatv#2242.

It would help a lot if you that are experiencing this would check your logs and compare the output with the one in the issue above, just so we can conclude it is the same problem. It looks something like this in the log:

Skärmavbild 2023-10-15 kl  19 42 18

@mikesalz
Copy link
Author

Hi @postlund - Thank you for looking into this! Here is my full error, which does match what you have shared. Please let me know if I can provide any other information which could be of help.

Authentication failed for Family Room Apple TV, try reconfiguring device
Traceback (most recent call last):
File "/usr/local/lib/python3.11/asyncio/tasks.py", line 490, in wait_for
return fut.result()
^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/locks.py", line 213, in wait
await fut
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/protocol.py", line 121, in _setup_encryption
await pair_verifier.verify_credentials()
File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/auth.py", line 135, in verify_credentials
resp = await self.protocol.exchange_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/protocol.py", line 145, in exchange_auth
return await self._exchange_generic_opack(frame_type, data, identifier, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/protocol.py", line 170, in _exchange_generic_opack
unpacked_object = await self._queues[identifier].wait(timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pyatv/support/collections.py", line 130, in wait
await asyncio.wait_for(self._event.wait(), timeout)
File "/usr/local/lib/python3.11/asyncio/tasks.py", line 492, in wait_for
raise exceptions.TimeoutError() from exc
TimeoutError

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

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/apple_tv/init.py", line 227, in connect_once
await self._connect(conf, raise_missing_credentials)
File "/usr/src/homeassistant/homeassistant/components/apple_tv/init.py", line 329, in _connect
self.atv = await connect(conf, self.hass.loop, session=session)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pyatv/init.py", line 136, in connect
await atv.connect()
File "/usr/local/lib/python3.11/site-packages/pyatv/core/facade.py", line 681, in connect
if await setup_data.connect():
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/init.py", line 573, in _connect
await api.connect()
File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/api.py", line 143, in connect
await self._protocol.start()
File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/protocol.py", line 108, in start
await self._setup_encryption()
File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/protocol.py", line 127, in _setup_encryption
raise exceptions.AuthenticationError(str(ex)) from ex
pyatv.exceptions.AuthenticationError

@postlund
Copy link
Contributor

@mikesalz That is excellent, thank you! I have made the necessary changes and made a release, just need to bump pyatv into Home Assistant.

@IceBotYT
Copy link
Contributor

IceBotYT commented Oct 20, 2023

This is the error I'm getting that's prompting the reconfiguration. This is only happening on one Apple TV, the other two work.

Authentication failed for Basement, try reconfiguring device
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 490, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/locks.py", line 213, in wait
    await fut
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/protocol.py", line 121, in _setup_encryption
    await pair_verifier.verify_credentials()
  File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/auth.py", line 152, in verify_credentials
    await self.protocol.exchange_auth(
  File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/protocol.py", line 145, in exchange_auth
    return await self._exchange_generic_opack(frame_type, data, identifier, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/protocol.py", line 170, in _exchange_generic_opack
    unpacked_object = await self._queues[identifier].wait(timeout)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyatv/support/collections.py", line 130, in wait
    await asyncio.wait_for(self._event.wait(), timeout)
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 492, in wait_for
    raise exceptions.TimeoutError() from exc
TimeoutError

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/apple_tv/__init__.py", line 227, in connect_once
    await self._connect(conf, raise_missing_credentials)
  File "/usr/src/homeassistant/homeassistant/components/apple_tv/__init__.py", line 329, in _connect
    self.atv = await connect(conf, self.hass.loop, session=session)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyatv/__init__.py", line 136, in connect
    await atv.connect()
  File "/usr/local/lib/python3.11/site-packages/pyatv/core/facade.py", line 681, in connect
    if await setup_data.connect():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/__init__.py", line 573, in _connect
    await api.connect()
  File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/api.py", line 143, in connect
    await self._protocol.start()
  File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/protocol.py", line 108, in start
    await self._setup_encryption()
  File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/protocol.py", line 127, in _setup_encryption
    raise exceptions.AuthenticationError(str(ex)) from ex
pyatv.exceptions.AuthenticationError

@IceBotYT
Copy link
Contributor

This is the error I'm getting that's prompting the reconfiguration. This is only happening on one Apple TV, the other two work.

Authentication failed for Basement, try reconfiguring device
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 490, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/locks.py", line 213, in wait
    await fut
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/protocol.py", line 121, in _setup_encryption
    await pair_verifier.verify_credentials()
  File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/auth.py", line 152, in verify_credentials
    await self.protocol.exchange_auth(
  File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/protocol.py", line 145, in exchange_auth
    return await self._exchange_generic_opack(frame_type, data, identifier, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/protocol.py", line 170, in _exchange_generic_opack
    unpacked_object = await self._queues[identifier].wait(timeout)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyatv/support/collections.py", line 130, in wait
    await asyncio.wait_for(self._event.wait(), timeout)
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 492, in wait_for
    raise exceptions.TimeoutError() from exc
TimeoutError

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/apple_tv/__init__.py", line 227, in connect_once
    await self._connect(conf, raise_missing_credentials)
  File "/usr/src/homeassistant/homeassistant/components/apple_tv/__init__.py", line 329, in _connect
    self.atv = await connect(conf, self.hass.loop, session=session)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyatv/__init__.py", line 136, in connect
    await atv.connect()
  File "/usr/local/lib/python3.11/site-packages/pyatv/core/facade.py", line 681, in connect
    if await setup_data.connect():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/__init__.py", line 573, in _connect
    await api.connect()
  File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/api.py", line 143, in connect
    await self._protocol.start()
  File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/protocol.py", line 108, in start
    await self._setup_encryption()
  File "/usr/local/lib/python3.11/site-packages/pyatv/protocols/companion/protocol.py", line 127, in _setup_encryption
    raise exceptions.AuthenticationError(str(ex)) from ex
pyatv.exceptions.AuthenticationError

I didn't notice the error above was the exact same, my bad! 😅

@kevinhaas
Copy link

i have an ATV 4k (3rd gen) and tvOS 17. with tvOS 16 all worked without any issues - now i can't even pair it = the integration doesn't find the ATV at all.

Upgrade to 17 is also what killed the integration for myself. I reset my appletv for an unrelated issue and HA discovered it instantly after the reset.

@kwithus
Copy link

kwithus commented Nov 5, 2023

Unfortunately, for me it’s still not working, although I am on 2023.11.1 as well.
Even worse, now it’s not only the ATV, one (of three) HomePod doesn’t respond either now.
All on 17.1, however the one not working is a HomePod2, the others are HomePod Mini

@muhlba91
Copy link

muhlba91 commented Nov 5, 2023

same here - still no change. HA doesn‘t find the ATV at all.

@postlund
Copy link
Contributor

postlund commented Nov 5, 2023

Not finding the Apple TV and requiring reconfiguration are different issues. I have not seen the reconfiguration problem so far. Connection failures will still happen, but they should not leave the integration in an unusable state (i.e. It should recover at some point without any manual intervention).

@muhlba91 what's your network setup like? Using VLANs?

@muhlba91
Copy link

muhlba91 commented Nov 5, 2023

no VLAN here; i scraped it due to such issues in the past.

HA runs in a k8s cluster virtualized on a Proxmox host which is connected to a 10Gb switch and directly connected to the Wifi AP. The AP is basically besides the ATV (it‘s the version without ethernet).

the k8s cluster is also the reason why auto-discovery of/for integrations on the network doesn‘t work properly and i have to put the static IP address of ATV in when setting up the integration. doing so returns „No devices found on the network“.

ATV airplay is set to everyone, and airplay from other Apple devices works across Apple accounts.

until the tvOS 17 beta everything worked well, then the integration stopped working and i removed it as i wanted to set it up new -> since then no chances to achieve that. i‘m still running on tvOS beta versions though. i had an ATV 4k 1st gen before, and then switched a few months ago to ATV 4k 3rd gen - neither of them worked to het them setup in HA.

@kevinhaas
Copy link

The only thing that got it to work for me was factory resetting my 4k 3rd gen; nothing else would get it to show in HA. It was discovered by HA as soon as the reset completed. This is a PITA but anyone who wants it working and is still having issues might want to give it a shot.

Still working for me after updating to 17.1

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@poudenes
Copy link

poudenes commented Feb 3, 2024

For me there are no issues at all anymore....

@github-actions github-actions bot removed the stale label Feb 3, 2024
@kwithus
Copy link

kwithus commented Feb 3, 2024

Still same problems here

@IceBotYT
Copy link
Contributor

IceBotYT commented Feb 3, 2024

I'm having the problem where one of my TVs go frequently unavailable, but it doesn't require constant reconfiguration anymore

@OCNice
Copy link

OCNice commented Mar 8, 2024

I upgraded to 17.4 yesterday, Still doesn't work for me. I guess I'll try resetting.

@ste-fle
Copy link

ste-fle commented Mar 24, 2024

I'm having a similar problem, especially with Homepod (Minis) (everything on 17.4, but indeed might have startet with 17.0) - they constantly lose their connection / state in HA and I frequently have to reload the integration for each of them to get their current state working again.

@poudenes
Copy link

Strange. Because I don't have those issues at all...

@ste-fle
Copy link

ste-fle commented Apr 11, 2024

It seems that this always happens when one of them is restarted manually (due to some Airplay or Homekit issues) - afterwards their status won't be visible in HA anymore unless the integration is also reloaded for that particular HomePod.

@normalee1993
Copy link

Has there been any development/news on this issue? I currently have a work around to reload the integration every time my Sony tv gets turned on which turns the Apple TV turned via eARC. It seems that once the Apple TV powers off, it loses its connection status to home assistant.

This happened around the time of tvOS 17 coming. Happy to collect logs if needed to help out.

@mikesalz
Copy link
Author

This was "fixed" a while ago, so it does not constantly require reconfiguration as I mentioned in my initial bug description. But as several have pointed out, the integration often disconnects/fails after a restart of the ATV. I created a workaround also - Any time my Harmony remote starts the TV activity, it reloads the ATV integration. That seems to be working. But I don't think we should have to do these kinds of workarounds. @postlund thoughts?

@BaconPhat
Copy link

BaconPhat commented Jul 4, 2024

Same here- I took the update to TV-OS17, just updated the latest HASS 2024.7.0, it seems to have made things worse. I have restarted my HA multiple times, things work for a bit, then HA boots out all things Apple TV

@poudenes
Copy link

poudenes commented Jul 4, 2024

Strange... Here latest tvos and latest HA (update from yesterday) and everything is working great....

@kevinhaas
Copy link

kevinhaas commented Jul 7, 2024

I got another ATV4K and this is still an issue. I added it to HA, then performed an upgrade from 17.2 -> 17.5 and now it's unavailable in HA. Reloading the integration does nothing. I can't re-add the device to HA without factory resetting it either. Both my ATV4Ks entered this same bad state after updating firmware.

Trying to re-add the same ATV by name/IP without factory resetting it first results in:
No devices found on the network

I can assign it the same IP after factory reset, and adding it to HA works fine. Some key is getting bungled up here.

If this isn't going to be addressed, it should be noted in the documentation at the least. "Don't add the device to HA until you update the firmware or you'll have to set it up again".

EDIT: I also had to turn off airplay entirely for this device to re-add, very strange. I never explicitly did this before. It asked me for an "RAOP" PIN but wouldn't accept what the screen displayed. My other ATV has airplay on and I don't remember this.

EDIT 2: Haha! Now my original ATV is not showing in HA! Good thing I really only use one app and don't actually need this integration. This one has reached my time limit of messing around.

@Kerryliu
Copy link

Kerryliu commented Jul 7, 2024

From what I can tell, all the “fixes” in this issue are temporary. After a while (for me it was a day) the Apple TV becomes available again.

@kevinhaas
Copy link

kevinhaas commented Jul 7, 2024

My original has never fallen off, and I just re-added my new one after factory re-setting and now it works as expected.

Most likely different issues.

EDIT: My original ATV device has fallen off now for the first time ever and the new one is also not connecting to HA after initially showing the correct status. Looks like messing with the configuration or adding other devices borks this beyond repair.

image

Here is Channels DVR which is playing on the ATV reporting correctly while both ATVs show the wrong statuses. I'm disabling this integration for now and will check back in a few months. Luckily I only use one app and can work around this.

image

Haha, my original stable ATV fell off the moment I added my new one, I just didn't notice. That was the only Apple device on my network and worked flawless for nearly a year. Looks like other people have issues with multiple Apple devices outside of ATVs also. No way I'm wasting time trying factory resetting again ;)

@mscodemonkey
Copy link

mscodemonkey commented Jul 15, 2024

Hi postlund sorry to say it but I'm still getting this error. Log entry enclosed. Both Apple TV and HA are updated to latest as of today.

However, If I go into the HA interface and restart the Apple TV integration then it connects and all good.

Logger: homeassistant.components.apple_tv
Source: components/apple_tv/__init__.py:281
integration: Apple TV (documentation, issues)
First occurred: July 14, 2024 at 8:26:37 PM (2 occurrences)
Last logged: 3:02:22 AM

Failed to connect
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pyatv/support/http.py", line 463, 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.CancelledError

During 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 462, 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.TimeoutError
TimeoutError

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/core/protocol.py", line 56, in heartbeater
    await sender_func(message)
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/airplay/ap2_session.py", line 94, in _send_feedback
    await self.rtsp.feedback()
  File "/usr/local/lib/python3.12/site-packages/pyatv/support/rtsp.py", line 248, in feedback
    return await self.exchange("POST", uri="/feedback", allow_error=allow_error)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyatv/support/rtsp.py", line 293, in exchange
    resp = await self.connection.send_and_receive(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyatv/support/http.py", line 474, in send_and_receive
    raise TimeoutError(f"no response to {method} {uri} ({protocol})") from ex
TimeoutError: no response to POST /feedback (RTSP/1.0)

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 281, in connect_once
    await self._connect_once(raise_missing_credentials)
  File "/usr/src/homeassistant/homeassistant/components/apple_tv/__init__.py", line 266, in _connect_once
    await self._connect(conf, raise_missing_credentials)
  File "/usr/src/homeassistant/homeassistant/components/apple_tv/__init__.py", line 386, 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 684, in connect
    if await setup_data.connect():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/mrp/__init__.py", line 1092, in _connect
    await protocol.start()
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/mrp/protocol.py", line 133, in start
    await self.connection.connect()
  File "/usr/local/lib/python3.12/site-packages/pyatv/protocols/mrp/connection.py", line 104, in connect
    await self.loop.create_connection(lambda: self, self.host, self.port)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1122, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1104, in create_connection
    sock = await self._connect_sock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1007, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 641, in sock_connect
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 681, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.1.62', 7000)

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@julian-klode
Copy link

Still a problem in 2024.10.2 with tvOS 17.6.soomethiing

@poudenes
Copy link

Everything work great here... No issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests