Apple tv mediaplayer component - questions

I’m using hassio and tried to setup my apple tv in home assistant using this:

Apple TV component

Is it necesary to install this in hassio (or does it have this out of the box)
$ sudo apt-get install build-essential libssl-dev libffi-dev python-dev

Without using this command I was able to use scan and authenticate. I got the right Login ID and credentials.
With everything setup I’m know able to turn the TV by turning the remote switch (in ha) on.

However, it’s not possible to use buttons yet (left, right). If I use those commands in a script I get some errors, like:

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 277, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/remote/apple_tv.py", line 85, in _send_commands
    await getattr(self._atv.remote_control, single_command)()
  File "/usr/local/lib/python3.6/site-packages/pyatv/daap.py", line 84, in post
    yield from self._assure_logged_in()
  File "/usr/local/lib/python3.6/site-packages/pyatv/daap.py", line 128, in _assure_logged_in
    yield from self.login()
  File "/usr/local/lib/python3.6/site-packages/pyatv/daap.py", line 51, in login
    resp = yield from self._do(_login_request, is_login=True)
  File "/usr/local/lib/python3.6/site-packages/pyatv/daap.py", line 105, in _do
    action, False, is_login=is_login, is_daap=is_daap))
  File "/usr/local/lib/python3.6/site-packages/pyatv/daap.py", line 108, in _do
    'failed to login: ' + str(status))
pyatv.exceptions.AuthenticationError: failed to login: 503

and

Log Details (WARNING)
Unknown data: b'103'

As far as I know, you don’t have to install anything extra in Hass.IO. But based on the logs, you have entered an invalid login id. The fact that the Apple TV turns on when pressing the on-button is because it turns on whenever a request is made to it. No matter what the request is. My guess is that you forgot adding “” around the login id. YAML will translate everything starting with 0x from hex to an integer, so adding quotes will ensure the login is remains a string.

Thanks for your answer!

I tried adding “” but I get the same error.
Before adding I used the secrets.yaml file to use the login ID.
To avoid problems with that I followed you suggestion.

Weird thing is that I have the same loginID for both of my apple tv’s (credentials are not equal). Is this ok?

My config looks like this (changed loginid and credientials):

apple_tv:
  - host: 192.168.1.55
    login_id: "00000000-523de-e356-d85a3-309cd4d92ee4"
    name: Apple TV - Schlafzimmer
    start_off: true
    credentials: YYY
  - host: 192.168.1.56
    login_id: "00000000-523de-e356-d8593-309cd4892ee4"
    name: Apple TV - Wohnzimmer
    start_off: true
    credentials: XXX

I also tried ‘’ instead of “” but I still get the failed login error.

Is it normal to get equal Login_ID for two different Apple TV’s?

I have 4 Apple TVs and 2 Apple IDs - it seems the logon_id is linked to the Apple ID you have logged into with on the ATV.

I still get errors:

Unknown data: b’103’

A <class ‘pyatv.exceptions.AuthenticationError’> error occurred: failed to login: 503

Don’t know what else I could try.