Problems with Apple TV 4K status in HA

Just remove the beta version and use the one bundled with Home Assistant natively instead.

ok, thanks for the response, will try it.

1 Like

Hi Pierre, running all standard self discovered integrations. Plain vanilla setup. Atv 4k on latest firmware and HA on docker for RP4.
Everything runs pretty smoothly then after 2/3 days or sometimes more, it hangs. No other integrations affected.
Rebooting ATV4K does not bring it back. Only full RP4 system reboot or container reboot or integration reload get back to life.

Thanks!

Sounds strange. Do you see anything in the log? I suspect the connection is dropped (maybe device goes to sleep?) and is not properly discovered again.

Hello all -

Similar trouble here, just reports that the ATV 4K connection was lost.

@postlund – Thank you so much for workingon this in the past, we are very appreciative! Let me know what else I can do to try to help, either to find the details of the bug origin etc, happy to try stuff out and reproduce. Cheers!

Relevant log line below:

Logger: homeassistant.components.apple_tv
Source: components/apple_tv/__init__.py:169
Integration: Apple TV ([documentation](https://www.home-assistant.io/integrations/apple_tv), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+apple_tv%22))
First occurred: August 20, 2022 at 4:19:36 PM (1 occurrences)
Last logged: August 20, 2022 at 4:19:36 PM

Connection lost to Apple TV "abc"

Can you enable debug output as well? That would help a lot. Should be something like:

logger:
  default: warning
  logs:
    homeassistant.components.apple_tv: debug

will update you when i get something new!

@postlund attached are what looks like what you may need:

2022-08-29 21:39:45.720 DEBUG (MainThread) [homeassistant.components.apple_tv] Discovering device abc
2022-08-29 21:39:45.747 DEBUG (MainThread) [homeassistant.components.apple_tv] Connecting to device abc
2022-08-30 16:56:40.009 WARNING (MainThread) [pyatv.support.http] Got response without having a request: HttpResponse(protocol='RTSP', version='1.0', code=200, message='OK', headers={'date': 'Tue, 30 Aug 2022 23:56:39 GMT', 'content-length': '55', 'content-type': 'application/x-apple-binary-plist', 'server': 'AirTunes/620.8.2', 'cseq': '32489'}, body=b'bplist00\xd1\x01\x02Wstreams\xa0\x08\x0b\x13\x00\x00\x00\x00\x00\x00\x01\x01\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14')
2022-08-30 16:56:44.010 WARNING (MainThread) [homeassistant.components.apple_tv] Connection lost to Apple TV "abc"
2022-08-30 16:56:44.018 DEBUG (MainThread) [homeassistant.components.apple_tv] Starting connect loop
2022-08-30 16:56:44.019 DEBUG (MainThread) [homeassistant.components.apple_tv] Discovering device abc
2022-08-30 16:56:44.507 DEBUG (MainThread) [homeassistant.components.apple_tv] Connecting to device abc
2022-08-30 16:56:44.742 DEBUG (MainThread) [homeassistant.components.apple_tv] Changing address to 192.168.1.245
2022-08-30 16:56:44.743 INFO (MainThread) [homeassistant.components.apple_tv] Connection was re-established to device "abc"
2022-08-30 16:56:44.743 DEBUG (MainThread) [homeassistant.components.apple_tv] Connect loop ended
2022-08-30 16:56:44.749 DEBUG (MainThread) [homeassistant.components.apple_tv.media_player] Updating app list

Let me know if that is useful! Thanks!

@postlund Now this also popped up, may be relevant:

2022-09-12 21:36:28.970 DEBUG (MainThread) [homeassistant.components.apple_tv] Discovering device abc

2022-09-12 21:36:29.063 DEBUG (MainThread) [homeassistant.components.apple_tv] Connecting to device abc

2022-09-12 21:36:32.106 WARNING (MainThread) [homeassistant.helpers.frame] Detected code that uses str for device registry entry_type. This is deprecated and will stop working in Home Assistant 2022.3, it should be updated to use DeviceEntryType instead. Please report this issue.

Does anybody have an update on this? I integrated my 4K appletv a couple of weeks ago and everything worked great, up until the last few days when the state of the appletv would not update anymore. If I restart HA it starts working again for a short period.

I am running 16.2 on the appletv from the beginning. Enabled the debug logs for atv also but I don’t see anything reported as an issue

Thanks in advance!

edit: I was testing some more and it seems that the appletv does not go into idle/standy state. My automations were only looking at those two states so I assumed that the state updating was not working. When it stops updating the idle/standy state all other states are still updated so it’s probably an issue with the appletv itself
Seems like when the last state is playing or paused before the appletv is turned ‘off’ it does not go into idle or standy state anymore unless you restart it

Yeah Im getting a similar thing now. It just says its paused or playing. Im not getting a standby state

Anyone else?

Same player here.
It works the first then the Apple TV status is lost :frowning:
Reloading the integration make it works a few minutes/hours but then I get ‘deactivated’ status on the Apple TV entity.

Similar on my end too.

My AppleTV works as expected immediately after HA startup. But after a period of time, the state becomes stale.

I don’t thing anything in my logs related to AppleTV. I will continue to investigate.

1 Like

I have the same problem with my AppleTV4K.

Runs perfectly for minutes to hours but the stop reacting in status.
A reboot of Home Assistant solves the problem but then after minutes to hours its unresponsive again.

Solution?

Same thing here. Once the Apple TV (4K) enters standby, the integration never sees it come back online so I’m not getting any state changes. Reloading the integration works, but kind of a moot point IMO because that only works until it enters standby again. I think I’m in the same boat as a lot of users attempting to setup an automation to trigger when the the Apple TV is turned on or media starts playing, but having to manually reload the integration every time I wake up the Apple TV is not feasible and certainly not something I can expect anyone else in the house to do or even know how to do.

1 Like

Adding some detail here that I just noticed (and seems to align with other posts). The Apple TV experiencing issues is an Apple TV 4K (gen2) running tvOS 16.4. I have another Apple TV 4K (gen1) running tvOS 16.3.2 that works exactly as expected. Now I’m considering moving this one to the location I’m trying to use with automations :man_shrugging:

Fingers crossed this can be resolved for the gen2 because I have 3 more of this model that I’m looking to integrate in the future

@postlund I’m having similar status issues while my Apple TV stays off. While nobody is interacting, the status changes as follows:

Pausiert = paused
Unbekannt = unknown
Ausgeschaltet = off

Additional information:
:arrow_right: the hdmi output was during this time always off (black screen)
:arrow_right: Apple TV 4K (gen3) running tvOS 16.4.1
:arrow_right: Home Assistant Core: 2023.4.5
:arrow_right: Home Assistant Operating System: 10.0

Just noticed this myself. I have 3 apple TVs all 4k, but each of the last 3 generations. They are all updated with current iOS, and all have the same issue with not reporting status.

(Assuming “OFF” is when long press power button, or choose “sleep now” - setting will give no hdmi output black screen and power LED turn off.)

The ideal behavior should be: playing, pause → idle → standby

The most annoying part of the Apple TV is background running app so app like YouTube and Plex will remain in the background after you exit them - When playing status show “playing” and when you turn it “off” during playing the status will be “pause” and will remain “pause” even if the Apple TV is in the off state. Exiting app = pause, (Turn off during pause will remain pause).

Other app like netflix will change from playing/pause → idle when you exit then and → standby when you turn off the Apple TV.

Some app will remain on “idle” status when turn “off” the apple TV.

As a work around to get my turn “OFF” automation working properly I’ve gotten into the habit of force close apps before powering down - that will make sure the status of the Apple TV to change to “standby” as expected.

Unfortunately, there in no option in Apple TV to auto close app.
Any way for ATV to auto close apps? : r/appletv (reddit.com)

HI all,

I have the exact same problem with the AppleTV 4K (2gen), Home Assistant and my Denon receiver.

I’ve read the “solution” or “Fix” given by @postlund but I don’t think this is addressing the problem.
@Mabaelst Did you managed to solve the problem? Did passing through the AppleTV HDMI directly to the TV help (in case you tried it)?

I’d love to hear from you guys if there is a solution for this.

Thank you for the responses.