Add AppleTV to HASS

Hi all, I am trying to add my AppleTV to HASS, as described here: https://home-assistant.io/components/apple_tv/
I need to retrieve a loginid. The easiest way should be to call the apple_tv_scan under the apple_tv domain, listed under services.

But I don’t have the option to select apple_tv over there. How am I supposed to do this?

Add apple_tv: to your configuration and restart HA, then the services should be there.

1 Like

I tried that But then i get a invalid config message.

I found out that the only wat to get the apple_tv_scan service, is by addind apple_tv: to my config, and including the login_id: with fake data. But if I do the apple_tv_scan, no devices are found. Also with atvremote scan I get no results.

The thing that did kind of work, is apple_tv_authorize. When I did that a pin code appeared on my tv screen and after enteirng that I got a success message. But that was not enough to get it working.

Home sharing is enbaled.

Got it working! The trick was disabling Home sharing, and enable it again.

What version HA did you use? The issue with not being able to add just apple_tv: was fixed in 0.54. The authorize-thing is only for AirPlay, so that makes no difference in itself. Biggest problem as I see it is that Bonjour/zeroconf is not very reliable. In a lot of cases the device is not found and I’m not really sure how to fix that.

Regarding disabling and enabling home sharing, that is a good trick that seems to work for a lot of people. I should add that to the documentation.

I’m on version 0.53.1. But one of the things I treid is updating my Home Assistant. But now you are speaking about version 0.54. So I don’t really get that. I was asuming I was on the latest version.

I did not know any other people had the same solution of disabling and enabling home sharing. I came up with that myself. Could have saved me a lot of trouble if I read it somewhere lol.

Adding

apple_tv:

to my configuration.yaml file in 0.58.0 gave me the apple_tv domain and services on the little remote services view on the HASS UI… however, even though I have home sharing enabled, it still doesn’t find my Apple TV.

I’ve tried disabling and reenabling home sharing, and rebooting.

If I use the pyatv - atvremote CLI command, it discovers my Apple TV, but it says that home sharing is disabled and does not give a login ID.

$ atvremote scan
Found Apple TVs:
 - Apple TV at 192.168.86.61 (home sharing disabled)

So, I tried using atvremote pair, and that gave me a login ID (in a different format than the examples, but it was still a login ID).

$ atvremote pair
Use pin 1234 to pair with "pyatv" (press ENTER to stop)
Using pairing guid: 0xABC2809CA8188XXX
Note: If remote does not show up, try rebooting your Apple TV

Pairing seems to have succeeded, yey!
You may now use this login id: 0xABC2809CA8188XXX

I added that to my config, to find media_player.apple_tv and remote.apple_tv in my devices list, but HASS is still unable to connect to or control the apple tv.

¯\_(ツ)_/¯

What do you see in the error log? Can you control the Apple TV using atvremote with the login id you got from pair?

Hi! I seem to have the same problem as @broox

For me, atvremote pair does not make anything appear on the TV so I can not get any further there either… (I assume the pin should be put in on the TV?)

I’m running Hassio with 0.61.1 and a Apple TV 4.

Which error log were you asking for @postlund?

The reason for atvremote not finding the device is because Home Sharing is disabled in some way. By “in some way” I mean that something is not working as intended and it’s likely a bug or unintended behavior in tvOS (or you have actually disabled it). It seems like others have seen this too:

I had the same issue and disabled HS, rebooted and enabled it again. Has been working flawlessly on my device for over a week. Results seems to differ for different users and I do not know that else to do other than keep trying. I’ll see if I can get some time and start working on the MRP support again, that would remove need for HS altogether.

2 Likes

Aah, thanks! Did the same and then it was discovered!

1 Like

I had issues setting up my apple TV so I created a wiki from all the material and info I gathered, hope this can help someone else.

Thank you to the community.

Disabling HS -> restart ATV -> restart Hass.io -> Enable HS = Working!!!

Thanks Guys

I notice that there are a number of dependencies required (build-essential libssl-dev libffi-dev python-dev) per the instructions here.

How do I install these dependencies on Hass.io installation?

It should work out-of-the box in Hass.io, no need to install anything else.

Thanks @postlund.

I am trying to follow the instructions here for ‘Scanning for devices’… i don’t see an option for selecting Apple_TV as a domain.

Could someone please advise?
Thanks!

The Apple TV component is probably not loaded, try adding apple_tv: somewhere in your configuration.

Thanks - I will add the following to configuration.yaml… is that what you are suggesting?

apple_tv:
  - host: 192.168.1.138

I was confused since I could not complete the balance of the configuration variables listed on the tutorial page.

You only need to add:

apple_tv:

In order to use the scan service.