Reliably detecting Apple TV status changes

I have a 3rd gen Apple TV 4K connected to a receiver, and the receiver is connected to a TV. I also have an XBox connected to the receiver, and I use the receiver to change inputs. I’m trying to use HA or Nodered to help augment the simple remotes that come with each device. What I want to do is have the system:

  • Notice what device has turned on and change the receiver input to match
  • Notice the device turns off and shutdown the rest of the system

Originally, I tried to have CEC help here, but the XBox and Apple TV ended up fighting each other for control. The main issue is that I can’t find a reliable way to know what the Apple TV is up to. For example, I use a trigger that notices when the Apple TV leaves standby. Two strange issues come up with that:

  • When the XBox turns on, followed by the receiver and TV, the Apple TV goes to idle which proceeds to cause the input to change to the Apple TV.
  • So, I figure I watch for standby → idle to know it turned on. Nope! If the last person shut the system off while playing, then it goes to paused. Just to make it more fun, the status will sometimes go standby->paused->idle.
  • Of course, there also are periodic updates that happen that change the status from standby. My oldest son will be downstairs on a computer and suddenly the TV turns on at 1am.

The XBox is simple. Press the power button, and the status goes from off to on.

I’ve turned off CEC (too many headaches), but now I’m looking for a reliable method to know that someone pressed the power button on the Apple TV remote.

I use the Apple TV integration for a lot of automations, mostly in my movie theater, and it works pretty well. Standby should always be when it’s sleeping, something you can force in the settings so that if someone turns off in the middle of something then it will shut off eventually.

I also have smart TV’s or smart plugs on everything so I actually know if the TV is off or on via it’s power consumption, so if the TV is off for X minutes then you can send commands to the Apple TV to shut down or whatever.

For multiple inputs I have a system where it resets to a default state each night when I issue my “bedtime” commands. It turns on the TV, switches to the input I want to start on and turns off again.

I don’t have an Xbox anymore but when I did I would let the CEC switch to that and I know it’s on via integration, then when it goes off I had HA send commands to switch inputs back to the TV again. I use integration and Broadlinks to send my IR signals around as needed.

Using the above, the only time you should get into trouble is if someone turns off the TV while Apple TV is playing something, but you can send a command to auto-stop that if you have a smart plug on the TV.

I’m able to make it all work. However, the problem I have is that even if I have CEC off, the Apple TV turns on when I turn on the Xbox (ATV status standby->idle). So what happens is:

  1. Xbox turns on
  2. HA sees Xbox turned on, turns on receiver and TV, and sets input to Apple TV
  3. Apple TV comes on for some reason, which ends up changing the input to apple TV.
  4. I then get complaints from the family…

Too bad there doesn’t seem to be a way to catch the ATV’s power button being pressed. Tracking status does not seem to be reliable.

Ok, I found the magic other CEC setting in my Samsung TV. Now, the ATV doesn’t turn on when the Xbox turns on. So my automations work correctly now.

I also turned off all the automatic update settings on the ATV. Hopefully, this will prevent things from power on overnight.

1 Like