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
72.33k stars 30.27k forks source link

Apple TV Integration does not find devices #75828

Closed DaAwesomeP closed 1 year ago

DaAwesomeP commented 2 years ago

The problem

I am unable to add my Apple TV devices. They are a few different devices of different generations. When I go to add the devices by clicking the "Add Integration" button and selecting Apple TV, it does not find them automatically. When I input the IP address of a device (remains static through DHCP reservation), it still says "No devices found on the network."

I separately installed pyatv on my own computer, and I am able to talk to the devices just fine through the atvremote command.

I believe this may be related to having multiple network interfaces set up in my Home Assistant OS. This is the only integration that I have this issue with, and I am able to auto-discover all other integrations on my network (broadcast packets are working). I am running Home Assistant OS in a VM with one of the interfaces as a direct connection/bridge to my home network. In the Home Assistant settings I have manually (instead of auto) set this integration to use this network adapter.

What version of Home Assistant Core has the issue?

2022.7.7

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

I was not able to find anything relevant in the logs after enabling debug logging for this integration.

probot-home-assistant[bot] commented 2 years ago

apple_tv documentation apple_tv source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years 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! (message by CodeOwnersMention)

DaAwesomeP commented 2 years ago

Note: I also tried https://github.com/postlund/hass-atv-beta v3.0.1 via HACS and had the same issue.

DaAwesomeP commented 2 years ago

@postlund please let me know what further steps I can take to debug!

DaAwesomeP commented 2 years ago

Ping again, still not resolved (not stale).

nicx commented 1 year ago

similar problem here running HA in docker. any hints?

nicx commented 1 year ago

a short additional detail: other integrations (for example the outdated integration https://github.com/georgezhao2010/apple_airplayer) and other docker containers (for example owntone) are indeed finding my other apple devices directly, so maybe this apple_tv integration is just broken?

DaAwesomeP commented 1 year ago

Interesting, the integration you linked also uses pyatv. I wonder if this is an issue with newer versions of that package or with the official integration's implementation.

postlund commented 1 year ago

Home Assistant filters to only show Apple devices during discovery. This is because AirPlay v2 devices are not supported by pyatv, which leads to a lot of newer devices being discovered but unusable. It however also means that AirPlay v1 devices that should work are not found, which is a trade-off. These devices should be possible to add manually via IP though, as long as they are on the same network as Home Assistant.

DaAwesomeP commented 1 year ago

@postlund I am unable to add devices even by IP address even though I can ping them from the Home Assistant instance just fine. Have you tested with multiple network interfaces? I will try to do some more testing directly with Python.

Here are my interfaces from the HA settings page. The Apple TVs are on the checked network (although I suppose this setting should not affect adding by IP, which I am not sure is multicast): Screenshot 2022-10-17 at 22-16-42 Settings – Home Assistant

postlund commented 1 year ago

@DaAwesomeP If you can ping it doesn't really matter, it must be on the same network so that Home Assistant manages Zeroconf traffic from it. Is that the case?

DaAwesomeP commented 1 year ago

@postlund yes, it is on the same network

postlund commented 1 year ago

@DaAwesomeP Then you will have to enable logging for pyatv and see if you get any additional hints from that. Using wireshark from a device on the same network and look for the MDNS traffic might be a good idea too (port 5353 UDP between Home Assistant and Apple TV).

DaAwesomeP commented 1 year ago

Still working on this, but I will get back to you soon!

pederko commented 1 year ago

I'm having the same problem. Migated home assistant running in in docker containers on ubuntu to truenas scale. Tried with home assistant app on the offical chart and truecharts, same problem. Not able to reach Apple TV from the home assistant web GUI, but when I try to ssh into the app from truenas I can ping Apple TV. Seems to be same problem for reaching my Sonos speakers as well, so this looks like a network issue.

Although I can ping the Apple TV from the container I can't discover it with "atvremote scan". The container's IP is 172.16.0.227 and Apple TV is 10.0.0.101. Is that the problem? Any way to bridge this?

Any updates here?

tacogy3 commented 1 year ago

I am having the same exact problem as OP. No devices discovered and even entering the IP doesn’t pull up the devices. Everything is on the same network and I’ve had no problems with any other integrations getting setup.

tukane commented 1 year ago

@DaAwesomeP If you can ping it doesn't really matter, it must be on the same network so that Home Assistant manages Zeroconf traffic from it. Is that the case?

Interesting! Have the same issue like the OP, running HA in a docker container in a different subnet. But this worked before several month. Since a few weeks the integration is broken and neither using the name nor using the IP address works.

issue-triage-workflows[bot] commented 1 year ago

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.

DaAwesomeP commented 1 year ago

Unfortunately I have no longer have time to continue to investigate this, but it seems that it is quite reproducible.

issue-triage-workflows[bot] commented 1 year ago

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.