Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting when an Apple TV 4th generation has woken from sleep

I'm working on some home automation programs and one of the things I want to be able to do is detect when my 4th generation Apple TV has woken from sleep. This will generally only ever happen when someone pressed a button on its Siri remote to wake it up.

I have a PC (connected to the same TV as the Apple TV) that has a Pulse-Eight USB-CEC adapter, so naturally the first thing I tried was using CEC to determine when the Apple TV is awake. Unfortunately it's not reliable, since monitoring the Apple TV's power status to see when it wakes up produces false positives. (I should note that I do not have "Control TVs and Receivers" enabled on the Apple TV, and can't turn it on for the particular project I'm working on because I need the Apple TV to not change the TV's input.)

I'm trying to think of some other way to do this. I'm open to any possibilities, including things like:

  • Making use of private APIs on the Apple TV
  • Running an 'always on' program in the background of the Apple TV that sends a signal when the Apple TV wakes up, if that's even possible. (I suspect that it isn't.)
  • Monitoring the bluetooth communication between the Siri Remote and the Apple TV, if that's possible
  • Somehow filtering HDMI-CEC commands so that I can turn on 'Control TVs and Receivers', allow the Apple TV's CEC commands for turning on and off the TV, and exclude commands for changing the TV's input.
  • Any other method, no matter how hacky or ridiculous, as long as it works!

Does anyone have any suggestions? I'm running out of things to try!

like image 323
Bri Bri Avatar asked Feb 27 '16 21:02

Bri Bri


People also ask

How do I wake up my Apple TV from sleep?

To wake your Apple TV, press Menu or TV/Control Center on your remote.

Is Apple TV 4th generation obsolete?

Apple continues to sell the Apple TV HD (originally known as the fourth-generation Apple TV) for $149. Beyond changes to the Siri Remote, the device has not received any hardware upgrades since being released nearly seven years ago.

Can Apple TV Wake Up TV?

Put Apple TV to sleep If your TV or audio/visual receiver supports HDMI-CEC, your Apple TV automatically goes to sleep when you turn off your TV or receiver and wakes up when you select its HDMI input on your TV or receiver. You can also turn your TV or receiver on or off with the Siri Remote.

Is there a sleep time on Apple TV?

Press and hold the TV button. to open Control Center, then select Sleep. Open Settings. on Apple TV, then select Sleep Now.


1 Answers

I tried to post below on apple discussion / support communities but was told i don't have the right to post this content. Maybe someone in this group can succeed in doing it:

Apple TV 4 CEC integration is great when it works, but it doesn't work all the time and not with all the various equipment out there, you can do a search across forums and you will see lots of unhappy users. I would like to use a raspberry PI to detect when my AppleTV goes to sleep and wakes up and programmatically turn my tv on or off using its RS232C or custom CEC commands.

I used a bonjour services explorer and compared every single result between sleep and on states and there are no differences whatsoever.  I would have expected Apple to welcome such automation projects and make this information readily available with a variable such as status: sleep or status: on. 

Is there a way I could tell the two states apart via the network connection?

If not, could one build a TvOS app which runs on the background and makes this information available to clients somehow?

like image 152
Vedat Nommaz Avatar answered Sep 18 '22 13:09

Vedat Nommaz