Apple 4K TV - Home Assistant having troubles turning on/off, and other commands... over time

Hello Team, Apple 4K TV (Gen 3) works well and I can control the Apple 4K TV. But, after some time (such as overnight) I notice the Apple 4K remote = OFF as well as the media.player.

When the Apple 4K remote = Off, Home assistant cannot communicate with the Apple 4K. I cannot turn on/off… nothing. I must reload the Apple 4K service in HA.

Is anyone else having or had problems with HA controlling Apple 4K? If so, what are you do to make it work with HA?

That often happens to me right after I update the software on my AppleTV, but I’ve not had it happen randomly. As you said, reloading the integration seems to fix it. I’ve been wondering about trying to automate the integration reload, but I don’t think you can tell the difference between “I’m not using the AppleTV right now” and “HA can’t communicate with the AppleTV.”

In HA, I notice that when the Apple 4K Remote turns off, HA cannot communicate to it, no on/off, etc. Right now, I have the 4K set to ‘Never’ sleep so HA can continue to communicate with it.

I hope I can get this setup to be solid. If not, I may try ROKU next. Have you tried those?

I have not tried a Roku. Regarding the AppleTV I do have it set not to sleep. I do have an automation that suspends the AppleTV, and I think that mostly just turns off the HDMI port but keeps the OS active. I haven’t had any problems with connectivity, so maybe doing a full sleep causes it to disconnect from the network where suspend doesn’t do that.

I have been seeing this a lot in the last month such that I have created an automation to turn it back on whenever it turns off. I have 2 ATVs and 3 HomePods, happens with all but mostly the ATVs. My logbook shows the automation runs a lot but sporadically.

@pkscout I have tried the remote command ‘suspend’ to the ATV, but it goes to sleep and my automation to it are dead. Are you issuing the suspend command a different way? I’ll mess around with it again this weekend. Thanks for the info.

I noticed the same behavior–and it’d flip between either off or unavailable. I set an automation to trigger whenever an apple tv went into either of those states to restart the specific integration for that one. So far all of them have remained in “Idle”, which is the default state when apple TV is sleeping.

Yeah this seems to be a problem with an update in HA or Apple TVOS. The integration connection between HA and Apple TV is lost every time the Apple TV turns off (sleep mode). I did like you, a temporary automation:

Triggers:
State: When Apple TV goes FROM: On TO: Sleep mode (Viloläge in swedish)
State: When Apple TV goes FROM: Inactive TO: Sleep mode
State: When Apple TV goes FROM: Playing TO: Sleep mode
State: When Apple TV goes FROM: Paused TO: Sleep mode
State: When Apple TV goes FROM: Buffering TO: Sleep mode
(I couldn’t pick “Any state” because the automation would just keep looping)

Action:
Perform “Home Assistant Core Integration: Reload Configuration: Apple TV”

Can also play around with timers if you want to prevent connected automations from triggering. It’s a real duct tape solution but it’s a workaround until someone fixes this.

UPDATE: Even this workaround doesn’t seem to work. Once even a minute has gone the connection between HA and Apple TV is lost again. Only works if the integration is reloaded just before you turn on the Apple TV.