Okay, I have started to understand more and more in Home Assistant and Hassio but I have a problem that I had at startup which I must grab now:
I have paired my Apple TV 4K (5th gen) in the living room by the following:
The problem is that periodically it loses the connection and shows “Establishing a Connection to Apple TV” … To solve this, I need to restart Apple TV for the contact to resume.
Have followed the guides online when setting up Apple TV (“Scanning for devices” etc …)
I’ve checked the Apple TV’s IP and it’s the same all the time. Home sharing is on.
Is there any way to solve this.
When the Apple TV stop working the log says: A <class ‘pyatv.exceptions.AuthenticationError’> error occurred: failed to login: 503
Everything works flawlessly on the Apple TV 4 (4th gen) in the bedroom.
I am experiencing the exact same issue. I have an appleTV 4k which periodically loses connection, and an appleTV 4th gen that has never done so. I get the exact same error message in the logs. Additional messages that appear when home assistant loses connection to the appleTV 4K are below:
2019-02-15 22:58:31 INFO (MainThread) [pyatv.daap] implicitly logged out, logging in again
I have the same issue myself with two Apple TVs. Only solution I’ve found when it happens is to reboot.
It’s odd because I run…
$ atvremote scan
It only seems to find the one that’s working properly and telling me that home sharing needs to be enabled. I check both of them and they are both showing home sharing enabled.
It would be great if this didn’t require a reboot every time.
Same here, also my whole log is full of those unknown data b'103' and failed to login: 503 errors. I tried to turn on home sharing, get a new login id, updating apple tv, set the apple tv to not go in standby, but nothing really solved the issue, the only thing what helps for a week is rebooting the device once a week. (Apple TV Gen 4)
I’m experiencing the same issue. Wondering if there is anyway to automate a reboot intermittently every week.
Edit: rebooting doesn’t seem to resolve the issue in my case. Even though Home sharing is enabled and paired my 4K ATV isn’t seen via scan or the existing connection controllable.
I’ve had this same problem for over a year with my Apple TV 4K. My solution has been to have my Apple TV power plugged into a smart switch and an automation that cycles the power to reboot. It’s an ugly solution, but it works.
- alias: Reboot Apple TV
trigger:
platform: state
entity_id: media_player.apple_tv
to: 'unknown'
for:
minutes: 1
action:
- service: switch.turn_off
entity_id: switch.sonoff_apple_tv_switch
- delay: 00:00:01
- service: switch.turn_on
entity_id: switch.sonoff_apple_tv_switch
The 1 minute delay is to prevent false positives, which I used to have issues with as the state of the apple tv would sometimes be briefly ‘unknown’ when transistioning between states. Not sure why, but the reboot automation seems to be triggered most frequently when watching Netflix and leaving a show paused for a few minutes until the screen saver starts. Once I resume playback, the state goes to unknown i.e. “Establishing a connection…”
I have this exact same issue. My Apple TV 4th gen works great but my Apple TV 4k has the same intermittent issues. Reboot usually fixes it but it comes back in a week or two. Interesting idea about the smart switch to reboot the device, I will have to try it.
In troubleshooting I think this is more of an apple issue than Home Assistant / pyatv issue. According to the pyatv docs it is looking for the Bonjour service _appletv-v2._tcp.local to connect to the Apple TV. I downloaded a Bonjour scanner app (iOS app called Discovery in my case, but there are many others) and notice that when the issue occurs my Apple TV 4k is no longer listed in the _appletv-v2._tcp.local service but my Apple TV 4th gen is. After restarting the Apple TV 4k is listed in the _appletv-v2._tcp.local service again in the Discovery app and Home Assistant can connect. No idea what this means, I’m no Bonjour expert, but it’s a clue at least. Would be interested to know if others see the same thing or might have some insight.