Apple TV not working properly

Hope it’s OK to bump this, I haven’t made any progress. @postlund Can you confirm or deny that the behaviour I’m experiencing is the intended way?

Yes, you have basically answered your own question. If you use CEC then you will have to turn it off (preferably using start_off:) in HA when not using it, otherwise it will start automatically at some point (especially since HA will set up a connection to it and wait for changes). As I have said before and written in the documentation, this is the design chosen by Apple and nothing I can do anything about. Using an automation to turn it on, like you have described above is the best solution I have come up with, so that’s what I would recommend.

It’s kinda like you can’t have the cake and eat it to. In order to know what is currently playing, the device must be on. So yes, even if you disable CEC, the device will be on otherwise there will be no way of knowing what the device is up to. This is also how all other platforms and components work in HA, so it’s nothing unique here.

Regarding remotes, you will have to hide them manually. Remotes are setup automatically when a device is added. You can use them to send other key presses too (like arrow keys, menu, …) but you must use the service for that since the UI currently only implements turn on/off.

1 Like

Hi everyone,
I’ve added this configuration to my HA, but as a result my appletv seems to end up being not detected by HA. I can’t even find it as an entity. I’m wondering if apart from configuring HA this way, I’m supposed to do something else.
My understanding is that, in order to avoid AppleTV from switching on my TV over CEC, one must add the start_off toggler. If then one defines a static AppleTV, should that not generate an entity? assuming this is the case, why is it not being displayed in the Overview section of HA? If the answer is no, then I understand that the automations enable you to actually see an AppleTV in the Overview section?
thanks a lot in advance,

anybody can help me with this? Thanks! :slight_smile:

You should get a media_player entity. Have you taken a look into the log? Without any further details it’s hard to tell what’s wrong.

The configuration you quoted from me is the configuration I still use, however I don’t think the ‘start_off’ option is of any help in this case since it will handle the ATV as turned off and thus not poll anything. If you want to use any kind of trigger related to your ATV it must be switched on in HA.

If you remove your manually added section for the Apple TV and enable the discovery service again, do you see your ATV?

yes, if I let HA autodiscover it, it definitely finds my AppleTV (and switches on my TV set :frowning:)

1 Like

Hello,

this is what my configuration looks like

media_player:
  - platform: apple_tv
    name: AppleTV Dinning Room
    host: appletv4_dinningroom.kitusnetwork.no-ip.biz
    login_id: MY-LOGIN-ID
    start_off: true

I don’t see any message related to this in the logs view. I’m running hassio and it is a pretty well sealed platform… not sure where to check for logs other than in the section of the web environment.

Hello, I re-added this information to my configuration file and it now displays my AppleTV!! :wink:
Many thanks to everyone in this thread. Your help is much appreciated :slight_smile:

Not sure I follow. Now that I managed to set it up, may I ask what the differences are between HA autodiscovering an AppleTV and manually configuring it like you did?

Many thanks :slight_smile:

You should not add the media_player platform yourself, only the apple_tv: platform as it sets up the media player for you.

I already see the AppleTV on the main screen by adding this configuration found here. Is there anything missing?
thanks

Looks fine to me. Since you have start_off it will always be in off mode until you turn it on. So if you want to see any updates, try turning it on in the UI. You should see a message like “Establishing a connection…” for a long time if it doesn’t work. In that case you’ll have to look in the log.

Hello there,

I just figured that my apple TV was not reached by home assistant, so I started the scan service again and got

Found Apple TVs:
 - Apple TV Fitness at 192.168.1.228 (home sharing disabled)
 - Apple TV Cinema at 192.168.1.227 (home sharing disabled)

I finished to get it working by your suggested workaround:

Disable Home sharing
Restart AppleTV
Enable Home sharing

Now the scan finds my atvs and gives me the login_id.

With this id through the terminal I can control my atv - but it is no longer shown in my hass instance. No media_player is listed. I tried changing the config several times, but no help.
My log gives me:

2018-05-17 13:04:45 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/home/smartassi/homeassistant_v2/lib/python3.6/site-packages/homeassistant/components/apple_tv.py”, line 210, in _setup_atv
session = async_get_clientsession(hass)
File “/home/smartassi/homeassistant_v2/lib/python3.6/site-packages/homeassistant/helpers/aiohttp_client.py”, line 38, in async_get_clientsession
hass.data[key] = async_create_clientsession(hass, verify_ssl)
File “/home/smartassi/homeassistant_v2/lib/python3.6/site-packages/homeassistant/helpers/aiohttp_client.py”, line 55, in async_create_clientsession
connector = _async_get_connector(hass, verify_ssl)
File “/home/smartassi/homeassistant_v2/lib/python3.6/site-packages/homeassistant/helpers/aiohttp_client.py”, line 164, in _async_get_connector
connector = aiohttp.TCPConnector(loop=hass.loop, ssl=ssl_context)
TypeError: init() got an unexpected keyword argument ‘ssl’

I am not sure what to do now… :frowning:
Do you have an idea?

hey all,

I more than new to the hassIO world and therefore I try to deal with hardware I already have.
So I installed the apple TV and so far so good. The only problem I encounter are:
1: it never shows what the apple TV plays, except of “not title”
2: the play/pause button doesn’t work. I get the little popup that the command is send, but nothing happens at the apple TV. The prev/next buttons work fine. So a connection is established.

Any suggestions?

I just installed my hassbian system and out of the box it found my two apple tv’s. I am not having the problem that HASS is turning on my TV. So I found this thread.

However I have a problem in that I don’t know the settings for the media_player:
There is nothing in my configuration.yaml file regarding media_player:
A grep of all files in .homeassitant folder finds these entries in entity_registry.yaml

media_player.living_room:
name:
platform: apple_tv
unique_id: 605769f44…
media_player.bedroom:
name:
platform: apple_tv
unique_id: 27dee7fcc…

So how to I configure the start_off:true in configuraion.yaml?
media_player:

  • platform: apple_tv
    name: ???
    host: ???
    login_id: ???
    start_off: true
    I don’t know what my host or login_id should be.
    Should I use the “Living Room” and “Bedroom” values for name?

Hey @smart,

I am not 100% sure but I think you have to configure your apple TV like this:

apple_tv:
  - host: 192.168.1.227
    login_id: !secret APPLE_TV_LOGIN_ID
    name: AppleTv Kino
    start_off: True

so not media_player, platform apple_tv.
Hope it helps - just my 2 cents.

@VolkerRacho Thanks, did see the documentation on how to add apple tv. However that wasnt’ my question. What I was actually asking is "Why do my 2 apple TV’s show up on HA when I never configured them. This is a new install and the two apple tv’s where automatically discovered and added when I turned it on.

The only place a grep for apple finds them is in the entity_registry.yaml and the binary file home-assistang_v2.db which I don’t know how to read yet.
They appear in entity_registry.yaml like this

remote.living_room:
  name:
  platform: apple_tv
  unique_id: 605769f44...
remote.bedroom:
  name:
  platform: apple_tv
  unique_id: 27dee7fcc...
media_player.living_room:
  name:
  platform: apple_tv
  unique_id: 605769f44...
media_player.bedroom:
  name:
  platform: apple_tv
  unique_id: 27dee7fcc...

I think I want to remove them because I don’t find it that useful and when I boot my HA device my apple tv’s turn on which then turns on my TV. My understanding is I can also disable them by setting
start_off: true

I am not sure if I should edit entity_registry.yaml or add something to my config.

This has been a lower priority issue on my new setup so I haven’t tried too many things yet. So far I pretty much can’t get anything working so progress has been painfully slow.

I’m having some problems with the logic here and understanting how this works. I also had problems with HA turning on my appletv and tv so I added start_off: True to the config, problem solved.

However, there is a “remote” with AppleTV toggle in my UI, and it seems if I don’t turn this on manually, none of my automations based on AppleTV will work (if turning on the AppleTv from it’s own remote). Sometimes turning on this toggle will turn on my TV other times not. What is the idea of this “remote” ?

By setting start_off: true you are disabling the remote feature so you will notice the boolean toggle is Off as a current state. This prevents the remote from connecting to your TV and causing it to turn on. However this also disables the remote.

So I think in your automations when you want to take remote actions, first turn on the remote. The next time HA start it will default to Off and not wake your TV.

Personally I have not found the Apple TV interface all that useful so I have not played much with it but this is my general understanding if the way it was behaving when I was trying it.

1 Like