bluetoothtvosapple-tvhdmihome-automation

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:

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


Solution

  • Here I am, six and a half years later, and I've finally found a better way to get the power state of my Apple TV.

    I can simply use pyatv, which has a function named power_state that returns the Apple TV's current power state.