lukasroegner / homebridge-apple-tv-remote

Plugin for controlling Apple TVs in homebridge.
MIT License
132 stars 13 forks source link

plugin stops after AirPlay speaker is connected #77

Open Hanis1990 opened 4 years ago

Hanis1990 commented 4 years ago

Hello guys,

the plugin works pretty well for me unless I change the audio on ATV from HDMI to AirPlay speaker (SONOS One SL) and uncheck the HDMI audio. After this change the switch for the ATV in HomeKit turns OFF and the plugin doesn't react anymore. If I uncheck the AirPlay speaker and check the HDMI speaker, the plugin starts immediately working.

Somebody to have the same issue? Thank you for your comments and solutions.

lukasroegner commented 4 years ago

Hi @Hanis1990, Please provide the debug logs (parameter -D) from when you switch to AirPlay. In fact, there is one parameter that is related to AirPlay which is used to determine whether the Apple TV is detected as ON.

Hanis1990 commented 4 years ago

Hello @lukasroegner,

here is the log. At time [2020-11-10 16:09:32] I disconnect the AirPlay speaker. At [2020-11-10 16:09:44] I connect AirPlay speaker. Apple TV was ON for the whole time.

homebridge.txt

ghost commented 4 years ago

hi, got the same issue. To automate airplay connections I created a macro for the appletv and automated via HomeKit. If TV is on, trigger command switch which fires my macro. But every time atv connects successfully to a airplay receiver the plug-in lost every state of the atv.

Do you have any new infos?

lukasroegner commented 3 years ago

This is related to #30. In this issue, we developed a solution for the logic to determine whether the Apple TV is on. The current logic is:

It seems that in your case, the conditions do not match as your Apple TV still reports isProxyGroupPlayer == true even if you disable AirPlay (i.e. isAirplayActive == true).

I published a new version of the plugin (0.12.1) with more debug output for received message. Can you perform the same test again with the new plugin version? This could help to figure out whether other parameters have to be considered when checking the power state.

ghost commented 3 years ago

Hi Lukas, thank you for the response. I just checked the new version with the DEBUG-parm set to on. As you can see, isAirplayActive is "false" in every message, even when I switched trough all my airplay receivers via atv remote. homebridge.log When the least message was sent, I selected my Airport Express as audio device. Your plugin decided that the power state was OFF.

But the fact that in every message isAirplayActive is false is bad. This is the information I actually want work with. Are this message coming raw from the Apple TV? In that case I would guess it's a tvOS problem, right?

kind regards

lukasroegner commented 3 years ago

Thanks for the logs. The main issue is that this is not an official Apple TV API, not documented at all. Implementing a stable logic for the on/off switch is just pure guessing.

A-vesalius commented 3 years ago

Similar scenario for the 1 AppleTV I have selected a HomePod stereo pair as the default audio output under - Settings > Video and Audio > Default Audio Output. I have 2 other appletv which use the standard HDMI audio out and they work as expected. Happy to help with test and logs as needed. Thanks for the plugin