Apple TV 4 token and connect issues

Hi All

A <class 'concurrent.futures._base.TimeoutError'> error occurred: 
A <class 'aiohttp.client_exceptions.ClientConnectorError'> error occurred: Cannot connect to host 192.168.88.201:3689 ssl:None [Connect call failed ('192.168.88.201', 3689)]

Im constantly getting these errors in my log file. I can call the service to authenticate and it displays the input to put in my pin and the pin displays on the TV.

Its only after a while and after restarts etc that i get this error again.

Thanks

Seems like your Apple TV stops responding for some reason (it is unrelated to the authentication btw). Does the media player work as expected prior to this error, i.e. do you see state changes, is the title set, artwork and so on?

Screenshot 2020-02-10 at 13.50.42

This is what i see. If i auth then its fine but when it gives issues i see no state, just unknown.

Then it has never been able to establish a connection. Is it an Apple TV 4 or later?

Its an Apple 4 64GB 4k

Then that’s why. Current component doesn’t support tvOS. I’m working on fixing that and I will hopefully merge it back to Home Assistant quite soon. But you can install and use the beta version of the component from here:

I recommend using HACS.

Thank you.

I didnt see it in HACS. I added the python_script: to config and added the repo to HACs.

Does that look correct?

Yeah, it’s not in official HACS repo (as it will be archived once added to HA). So you have to add it manually. It looks good, should just have to install, restart HA and add device via Integrations page.

Thanks!

Is the format correct?

Living Room 192.168.88.201

Either enter Living Room or 192.168.88.201z

Ok thanks, amazing. Picking up my TV and my Yamamha soundbar.

Yeah, it’s likely because they are AirPlay capable. You will not be able to add them though (it will just fail). I might make better filtering for that in the future.

Did you manage to add your Apple TV correctly?

Yes thanks. It was working fine last night but this morning it doesnt respond to media playing etc.

Tue Feb 11 2020 05:38:53 GMT+0200 (South Africa Standard Time)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 344, in _async_write_ha_state
    entity_picture = self.entity_picture
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 760, in entity_picture
    image_hash = self.media_image_hash
  File "/config/custom_components/apple_tv/media_player.py", line 188, in media_image_hash
    return self.atv.metadata.artwork_id
AttributeError: 'NoneType' object has no attribute 'metadata'

I clicked the power button to turn it off but nothing seems to happen with on/off.

I did a off and then on now and then it picked up the media that was playing but the thumbnail looks a bit odd compared to my emby media thumbnails.

This is interesting as this should not be possible to happen. I have made some improvements to the connection logic and other minor checks that should have been there in the first place, so hopefully this problem will disappear. My intention is to make a new release later today/tonight, so maybe you can try with that once available? I will ping you here to let you know.

That’s a bit odd. I guess Emby can expose different artwork to the Apple TV media player compared to the external API, but it still seems odd. Can you check what artwork is presented in the Remote app in iOS? That is the golden reference here (I can only do what the app can do).