Add AppleTV to HASS

@postlund - super, that helped it show up.

Unfortunately, now I get a message:

“The following devices were found:
No device(s) found”

I checked that my home assistant was on as we but no dice.

Thanks!

The scan functionality is quite shaky in current stable version of pyatv (the underlying library). Lots of improvements have been made in the area in the upcoming version and I’m working hard to update the Home Assistant integration as well. But it will take some time.

If you are trying to add an ATV 4 or later, you can stop trying now as it’s not going to work (to save you some time).

no problem! I just figured I was doing something wrong. Thanks for your contribution!

Is there another way to find the Login ID?

Either you try atvremote on another computer on the same network, it sometimes work better. Or you use a zeroconf/bonjour browser to find the Apple TV services (appletv-v2 I think it’s called). It has a property named hG which is the login id. You could also pair with the device manually (using atvremote) and avoid using home sharing at all. It is documented here:

https://pyatv.readthedocs.io/en/master/atvremote.html#pairing-with-a-device

Thanks so much - I will try this today.

The issue with ATV 4 is only the scanning portion, correct?
I am assuming if I can locate the login ID, it will work with HA.

No, Apple TV 4 (or tvOS 13) is not supported at all. Bringing back support is what I’m working on.

OK - thank you for confirming!

Here is a beta version of the new component (you can add it to HACS as a custom repo):

Be sure to read the instructions before trying it out.

1 Like

Thanks @postlund, this works great!

1 Like

I am not able to follow your instructions on the install. I added the repository to HACS, installed, full “sudo reboot”, and then cant get any further. You said to go over to the integrations page to finish… not sure if that means in HACS or HASIO. Either way it doesn’t show up as an installed integration in HASIO, and I CAN see it as an installed integration in HACS but there is no way to edit. Side note my ATV/Apple TV scan is not showing up either so I cant get any of the required info for that step anyhow. Ideas?

You should go to Configuration -> Integrations and press the + in the downright corner. In the list you should see “Apple TV”. Select that, enter anything in the box, press submit, if zeroconf works you should get a descriptive text saying which devices are available (by name). Either enter one of the names or just IP-address if you know that instead.

Ahh ok, weird…integrations had always automatically shown up in the integrations page so I never even knew the “Plus” sign was there.

And I can get my IP address from my router and or those of you reading this, on your Apple TV you can go to settings/network and get it directly from there. Thanks for all the work you have put in so far! Going to be tinkering with it all day.

Yeah, auto-discovered devices shows up at the top and that is usually fine. Auto-discovery doesn’t work with custom components, otherwise it would show up as well (it is implemented).

Thank you and hope it works for you!

Working good so far Play, pause, next track, previous track, TTS, shows what media is playing. I was hoping “cast.show_lovelace_view” would work. :-/ But I guess one step at a time.

Is the apple remote setup via a different integration?

cast.show_lovelace_view casts a web page, AirPlay only works with media (video and sound). You would have to create something that takes screenshots of that page and generate video in realtime for that to work.

The remote is setup in parallel, so you should have a remote.<some name> available as well.

@postlund - thanks for your work on this. It has been working great for me.
What is the status of moving this beta to the official release?

Thanks for testing! :slight_smile: I’m a bit reluctant on giving estimates as it might bring false hopes (I usually underestimate), so I won’t do that. But I hope to be able to do that soon. I will finish the last parts of pyatv tonight and make some changes to the component. After that it’s mainly tests and documentation, which might take some time as I’m not very familiar with the test environment in Home Assistant. But I’m fairly close to finish now.

@postlund - aweosme!

Unfortunately, I have run into a problem… yesterday, I noticed that my Apple TV entity (media_player.apple_tv) is no longer appearing & my automations are broken.

I don’t see anything in homeassistant.log that points to an issue. I have tried removing the integration and reinstalling. Also, have tried restarting home assistant and rebooting as well.

Although this issue first came up yesterday, today the box updated to tvOS 13.3.1… so I don’t think that is related.

Any ideas how to diagnose?

I would recommend enabling some additional debug logs like this and see if anything interesting pops up:

logger:
  default: info
  logs:
    pyatv: debug
    custom_components.apple_tv: debug

thanks! i found that the entity got re-named somehow… I renamed it and now everything is great.