Apple TV - apple_tv:failed to login

Hey Everyone,
So I just upgraded to 0.38.1, added the apple_tv config to my media_player.yaml, after running the ‘atvremote scan’ to get my login ID, then restarted. I’m getting a login error in my log file. Here’s he details, and configs:

atvremote scan output:

Found Apple TVs:

  • Living Room TV at 192.168.X.X (login id: 00000000-0763-7101-c2b7-b6f779354b7b)


  - platform: apple_tv
    host: 192.168.X.X
    login_id: 00000000-0763-7101-c2b7-b6f779354b7b

Warning in logs:

WARNING:homeassistant.components.media_player.apple_tv:failed to login: 400 (bad login id?)

Any ideas?

I also tried running a command with atvremote directly, from the command line, and it worked fine. Here’s the command:

atvremote --login_id 00000000-0763-7101-c2b7-b6f779354b7b --address 192.168.X.X --debug select

And it’s output (with debug flag):

DEBUG: GET URL: http://192.168.X.X:3689/login?hsgid=00000000-0763-7101-c2b7-b6f779354b7b&hasFP=1
DEBUG: Data[32]: b’6d6c6f67000000186d73747400000004000000c86d6c69640000000400000002’
DEBUG: _login_request: mlog: [container, dmap.loginresponse]
mstt: 200 [uint, dmap.status]
mlid: 2 [uint, dmap.sessionid]

INFO: Logged in and got session id 2
DEBUG: GET URL: http://192.168.X.X:3689/ctrl-int/1/playstatusupdate?session-id=2&revision-number=0
DEBUG: Data[155]: b’636d7374000000936d73747400000004000000c8636d7372000000040000002463616673000000010063616665000000010063617665000000010063617673000000010063617073000000010363617368000000010063617270000000010063616172000000040000000663616173000000040000000263616b730000000101’…
DEBUG: _get_request: cmst: [container, dmcp.playstatus]
mstt: 200 [uint, dmap.status]
cmsr: 36 [uint, dmcp.serverrevision]
cafs: 0 [uint, dacp.fullscreen]
cafe: False [bool, dacp.fullscreenenabled]
cave: False [bool, dacp.dacpvisualizerenabled]
cavs: 0 [uint, dacp.visualizer]
caps: 3 [uint, dacp.playstatus]
cash: 0 [uint, dacp.shufflestate]
carp: 0 [uint, dacp.repeatstate]
caar: 6 [uint, dacp.albumrepeat]
caas: 2 [uint, dacp.albumshuffle]
caks: 1 [uint, unknown tag]
casc: 1 [uint, unknown tag]
cavc: True [bool, dacp.volumecontrollable]
casu: 0 [uint,]

DEBUG: Already logged in, re-using seasion id 2
DEBUG: POST URL: http://192.168.X.X:3689/ctrl-int/1/controlpromptentry?session-id=2&prompt-id=0
DEBUG: Data[0]: b’’
DEBUG: _post_request:

How did you even get atvremote scan to run? I upgraded to 0.38.1 and tried running that command from terminial but get command not found. I tried from multiple different directories and same error message.

1 Like

I ran into the same issue, it seems that atvremote is not installed when the component gets added. I just manually installed it after following the instructions on the github repo here:

oh ok thanks. I’ll give that a try

Source virtualenv (if you’re running hass in venv), pip3 install pyatv
Then you can run the command from the docs. :slight_smile:

1 Like

Do you have home sharing enabled on your Apple TV? (You have to)

Yep, Home Sharing is enabled, and signed in with my AppleID.

In terms of on screen UI I get very minimal.

According to the documentation isn’t it meant to be a little more interesting. Even when I’m playing a title, that is all I see, except for the name of the title and a progress bar. Nothing else.

I find it strange that atvremote works but home assistant doesn’t. Can you enable some additional logging so that we can see what is going on? This in your config should be fine:

homeassistant.components.media_player.apple_tv: debug

It will print the same thing you see with --debut in your home assistant log.

It all depends on what the app shares for metadata. Unfortunately a lot of times, not much information is given (some apps are better than others). It would be helpful if you could play some media in different apps, check output in home assistant as well as the Remote app in case you own an iOS device. If you see something in Remote, it should also be visible in home assists and. Otherwise it’s a dead end I’m afraid.

Thanks - sorted that problem :slight_smile:

@postlund I seem to of fixed my issue by manually restarting the HA service a few times. Problem solved.

Cool! One guess is that you managed to have two instances running at the same time. That doesn’t work so gdóod.

Is that to say multiple Apple TV’s can’t be used simultaneously? I seem to trigger the failed to login: 400 (bad login id?) error whenever I fire up our second ATV.

That should be fine, but I only own one device myself so I can’t verify. But I think @robbiet480 runs at least two devices independently. Maybe he can answer?

Maybe you could try enabling logging as I suggest above to see what happens? Also, I think this would be solved by pairing home assistant with your device. But that doesn’t work yet and I would not recommend it for now. Hopefully I will manage to add support in next release.

I’m getting an error around my appletv configuration which is understandable since I haven’t set it up and don’t really see a need to for my uses. Do I have to configure it to get it to stop complaining about it? Same with cast?

What error are you getting? If you’re not going to set it up, why include it in your config?

Is it the same error? If home sharing is not enabled it should not be found and not bother you. Otherwise you do and in that case you currently cannot disable it. But it would be good to figure out why it doesn’t work.

I didn’t include it in my config. LOL

home-assistant.log:17-02-14 09:56:28 INFO (Thread-15) [homeassistant.components.discovery] Found new service: apple_tv {'name': 'Apple TV', 'hsgid': '00000000-07ce-0a48-9410-cd36ff1d4845', 'host': ''}
home-assistant.log:17-02-14 09:56:28 INFO (MainThread) [homeassistant.core] Bus:Handling <Event platform_discovered[L]: service=load_platform.media_player, platform=apple_tv, discovered=name=Apple TV, hsgid=00000000-07ce-0a48-9410-cd36ff1d4845, host=>
home-assistant.log:17-02-14 09:56:28 INFO (MainThread) [homeassistant.loader] Loaded media_player.apple_tv from homeassistant.components.media_player.apple_tv
home-assistant.log:17-02-14 09:57:30 ERROR (Thread-1) [homeassistant.bootstrap] Not initializing media_player.apple_tv because could not install dependency pyatv==0.1.4