home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.82k stars 30.08k forks source link

Apple TV HA integration does not detect when out of standby mode #102784

Open rwez opened 11 months ago

rwez commented 11 months ago

The problem

Whenever my apple tv goes into Standby mode, HA will not detect when the Apple TV is turned on again. It will stay in "Standby" forever until you reload the integration. HA logging only reports when the Apple TV enters standby mode, but will not report anything when Apple TV is turned on again.

This is very unfortunate for the automations I run for Apple TV

Apple TV 4K gen 2

What version of Home Assistant Core has the issue?

core-2023.10.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

apple_tv

Link to integration documentation on our website

https://www.home-assistant.io/integrations/apple_tv/

Diagnostics information

2023-10-24 23:15:41.625 WARNING (MainThread) [homeassistant.components.apple_tv] Connection lost to Apple TV "Living Room" 2023-10-24 23:36:37.794 WARNING (MainThread) [pyatv.support.http] Got response without having a request: HttpResponse(protocol='RTSP', version='1.0', code=200, message='OK', headers={'Date': 'Tue, 24 Oct 2023 21:36:37 GMT', 'Content-Length': '55', 'Content-Type': 'application/x-apple-binary-plist', 'Server': 'AirTunes/710.79.1', 'CSeq': '441'}, 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') 2023-10-24 23:36:41.796 WARNING (MainThread) [homeassistant.components.apple_tv] Connection lost to Apple TV "Living Room"

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 11 months ago

Hey there @postlund, mind taking a look at this issue as it has been labeled with an integration (apple_tv) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `apple_tv` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign apple_tv` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


apple_tv documentation apple_tv source (message by IssueLinks)

ChrisWest1995 commented 11 months ago

I have the same issue. The integration does not detect out of stand-by mode. Running iOS 17 voor Apple TV.

jfchadeyron commented 11 months ago

Same issue too

HouseofTyrell commented 11 months ago

I’m having the same issue for both my Apple TVs.

cyberden commented 10 months ago

I'm having the same issue with an apple tv 4k gen 2.

I'm keeping the ATV always on but it's a pity...

thearrow commented 10 months ago

Same issue here. It used to work fine, but this behavior started after the upgrade to tvOS 17, I think.

CV8R commented 10 months ago

Same issue here on two Apple TVs an Apple TV 4K (gen 3) and a Apple TV 4K (gen 2). Made sure that Allow Access is set to Same Network and also tried a manual static IP address on one unit.

Wijnand commented 10 months ago

Confirmed, same issue here.

CV8R commented 9 months ago

Same issue here on two Apple TVs an Apple TV 4K (gen 3) and an Apple TV 4K (gen 2). Made sure that Allow Access is set to Same Network and also tried a manual static IP address on one unit.

This issue is now gone for me. Sharing if it helps identify the cause.

What has changed is we turned to the dark side and embraced Apple (rightly or wrongly) from Android. Three things changed.

  1. Bought iPhones.

  2. Added the HomeKit integration to HA - manually configured in YAML.

  3. Setup the Apple Home App and added the two ATV's.

endrift commented 9 months ago

Same here, and I'm pretty sure it happened when I upgraded to Apple TV 17, or possibly to 17.2 specifically. It was one of the recent upgrades. Core 2023.12.3 here, in case it matters.

I'm seeing very similar output in my log files, which is what led me to this report.

knaak commented 8 months ago

I have been trying to setup an automation when my AppleTv turns on to also turn on some home theatre lighting. The device sits in Standby all of the time when you look at the time graph in HA. However, when I investigated a bit more and found that what appears to be happening is that the device sets status as "On" and then simultaneously sets the status back to "Standby". Since status is 'last status' then the "on" state is effectively buried in the stack of status.

image

Perhaps understanding how status are ordered or communicated could help ensure that "on" is the last status if there is more than one generated somehow.

dominiclesinski commented 8 months ago

While we all wait for an official fix, just sharing my workaround for the time being. I usually turn on the TV at the same time as the Apple TV (i.e. use the ATV remote to turn the TV on via HDMI CEC). As the TV is integrated into HA as well I have set up an automation that reloads the Apple TV Integration when the TV changes state to On.

Has been working "flawlessly" for several weeks now until this is sorted. Service is: Home Assistant Core Integration: Reload config entry

knaak commented 8 months ago

Speaking of workarounds, I found a work around by using the Unifi Integration to track bandwidth consumed by the AppleTV and setting a binary sensor based on the sum of 5 minutes of or so of activty being greater than some level (couple of mb). Then i use the binary sensor to build my automations. It might not work correctly when the device is downloading updates in the background but it works better than nothing.

cyberden commented 8 months ago

I did the same using my harmony hub as a trigger and re-enabling the remote entity of the apple tv which works :

image

The delay is 2s.

SalmonSays commented 8 months ago

https://github.com/home-assistant/core/issues/106689#issuecomment-1899194766

It looks like the AppleTV is waiting to update its status from standby until it can confirm over HDMI that a device is actively receiving/displaying. As a temporary workaround I am using a low power HDMI splitter with a dummy-plug in output #2, collectively it cost me $15-20. It's a little janky feeling to me as hardware solutions go, but the trigger now works flawlessly for me as I expect it to, allowing me to control lights/projector/scripts/etc all from the AppleTV power button.

Notrial commented 7 months ago

Are there any updates scheduled that might resolve this? I learned that even if I turn off sleep on the ATV, it eventually stops updating status. Quick on/off on the remote entity refreshes it (or reloading the integration configuration), but automation is useless unless this is fixed.

amaisano commented 6 months ago

May or may not be the same issue, but I have an Apple TV HD and an Apple TV 4K.

The 4K works reasonable well - the remote entity stays "on."

The HD remote entity is almost always switching itself "off" which prevents me from using controls, even through the HD is on/playing stuff.

I used to be able to fix the HD remote by toggling the remote back on and off a couple times, but this week it's been terrible and the integration is failing to reload many times until finally it gets back to working.

homeassistant.exceptions.ConfigEntryNotReady: Protocol(s) RAOP not yet found for Living Room, waiting for discovery.

edmondss commented 6 months ago

same issue

normalee1993 commented 6 months ago

Any up on this issue? Is it maybe an Apple issue? I am having the same problems

dankocrnkovic commented 5 months ago

Same issues. ATV not reporting waking up. I noticed that as soon as I turn on my AVR, that gives it HDMI signal, ATV reports at that moment. So at the moment it is not possible to have automation to turn on AVR and TV on Apple tv power on.

Can we get any feedback on this? Looks li nobody looked at his from October

edmondss commented 5 months ago

Same issues. ATV not reporting waking up. I noticed that as soon as I turn on my AVR, that gives it HDMI signal, ATV reports at that moment. So at the moment it is not possible to have automation to turn on AVR and TV on Apple tv power on.

Can we get any feedback on this? Looks li nobody looked at his from October

Do you have homepod too? I experienced similar problem with that as well.

Notrial commented 5 months ago

It really is weird that no one is tackling this, as widespread as this hardware is. But I guess it is one of those Apple problems that are unsolvable before Apple does something on their end :(

dankocrnkovic commented 5 months ago

Do you have homepod too? I experienced similar problem with that as well.

No, just Apple TV. Here are some expiriances.

On Denon receiver: On Apple TV On, it will change state to Idle for 1 second, and if receiver is not turnet on it will fall back to standby. If I turn on Receiver, state will change to Idle.

On Yamaha receiver: On Apple TV On, nothing happens. State stays on Standby. As soon as I turn on receiver, Apple TV changes to Idle.

On Apple TV CEC is disabled in both cases. I dont want CEC to mess around with devices.

The issue is definitely related to HDMI signal and it depends how "parent" devices handle it.

edmondss commented 5 months ago

Do you have homepod too? I experienced similar problem with that as well.

No, just Apple TV. Here are some expiriances.

On Denon receiver: On Apple TV On, it will change state to Idle for 1 second, and if receiver is not turnet on it will fall back to standby. If I turn on Receiver, state will change to Idle.

On Yamaha receiver: On Apple TV On, nothing happens. State stays on Standby. As soon as I turn on receiver, Apple TV changes to Idle.

On Apple TV CEC is disabled in both cases. I dont want CEC to mess around with devices.

The issue is definitely related to HDMI signal and it depends how "parent" devices handle it.

I have my homepod connected as audio output for ATV. It has issues too. Someone it went to OFF and requires reloading. Whenever HA reboots, the volume level of the homepod will be set to zero will totally disrupts my automations. Just wonder if this is going to be fixed.

stibbzy commented 2 months ago

I have exactly the same issue....

Smiie-2 commented 2 months ago

Same, any updates on a fix?

endrift commented 2 months ago

Several people posting "any update?" or "me too" isn't gonna help this move any faster. It's just gonna annoy the dev, and also everyone else who's subscribed to this issue.