Apple TV - apple_tv:failed to login

Thanks for the update! I believe that this is linked to the “dancing media player” issue. Requests are made for the artwork but it isn’t available. I’m hoping to fix this soon, but I’m currently blocked from releasing next version of pyatv with lots of updates due to external requirement issues. Hopefully this will be resolved once I can get the release out the door.

I made the change without upgrading the library and it was merged quickly. So, feel free to try latest dev out and see if it works!

To add on to my post from yesterday:

I restarted HA and the 400 errors went away, the module connected and reported and controlled the ATV successfully. The “dancing” continued obviously.

Scratch that, error comes back eventually.

Updated HA to 0.43. Rather than multiple 400 errors, I now have just one (I imagine this is due to the “dancing” player fix :slight_smile: ).

atv shell command still works successfully, but the component does not update when the ATV starts playing something. It only ever displays “No title”.

That is somewhat better at least :blush: What have you tried playing? I’m not sure how much metadata is avsilande through DAAP on the ATV4. If you try to stream some music, can you see title then?

I use it primarily with Plex, and occasionally BBC iPlayer.

The best I can say is it sometimes works. I haven’t yet managed to find a pattern where I can make it not connect, nor a pattern where I can make it connect.

Happy to try any suggestions!

I think it’s a bit up to the app and I know that plex in particular is a bit strange. Not much I can do I’m afraid until I can implement the new protocol.

Hmm I’m not sure I agree with that - because when I use the actual atv command I get a correct output. That’s what I don’t understand. It should work. If I didn’t get a 400 error at some point during HA execution, it should work.

I don’t know what causes the 400 error though, and I don’t know at what point it tends to occur.

Oh, ok, that’s very strange yes. Question is what the library is getting for information during updates. Can you add debug logging for pyatv.daap and upload some log outputs?

Done. Will get back to you after I’ve got some data :slight_smile:

1 Like

I have just seen these errors in the logs too, they appear every 10 seconds

If it is of interest , the media player widget that I have for my Apple TV on the main screen says that it is 'Not Connected to Apple TV"

If I press the power button icon on that widget, which changes it to ‘off’ - it looks like those 10 second log entries stop.

If I power it back on again, it still shows that it is 'Not Connected…" and the log starts to fill up again.

Is this with the latest version of home assistant installed?

I’m currently running 0.42.4

Should be fixed in 0.43.

Hey @postlund ,

So here’s some logs. HA was started up whilst the TV was off and the Apple TV was sleeping (presumably).

  • Started HA around 13:30
  • HA log of pyatv and debug codes: https://hastebin.com/givonexugo
  • Turned on TV and played BBC iPlayer around 18:00
  • Log of /srv/homeassistant/bin/atvremote --debug -a playing: https://hastebin.com/fumozifawo
  • Apple TV component still displaying “No title”
  • No further logging by pyatv in HA log after ~13:28

Let me know if you want more, or if you want me to test a specific sequence of events.

Wow, that’s really strange. Like if polling and push updates give different result. Can you try to shut down hass and poll with “playing” (to atvremote) and verify that title is present. Then do the same but use “push_updates” instead of playing. They should give the same output.

In the following log I stop HA and then turn on the TV and play a snooker match. The results of playing and push_updates are identical (with different login IDs though).

https://hastebin.com/nowupuheli

Ok, so, based on what you have posted (and wrote on Gitter) my educated guess is that push updates are not working as they should. Looking at the Home Assistant time stamp and when you started the program, that output does not match the log output. The revision number (57 vs 63) suggests that something happened in between. Did you manually run atvremote several times? Just want to verify what we’re looking at here.

But… I see no reason why push updates should not work. Maybe you can run home assistant with pyatv logging enabled, runt atvremote from another shell and see if Home Assisstanr tries to login again? Current GET-request should abort.

1 Like

I don’t think so… but now I think about it I have a “start tv” shell command which calls atvremote 4 times to push buttons. That would get us from 57 to 61 (if that’s the way it works). No reaction in the HA logs though.

I will try that and report back.

Yeah, there’s where the increase come from. Really strange that the request hangs. I believe I saws something similar with my device, I’ll see if I can reproduce.