Apple TV Sleep Support


#1

Feature Description:
Many users (such as myself) have an Apple TV 4k (A1842 (32 GB)) running 12.1 tvOS and have it CEC enabled with a television & receiver. This makes for a simple 1 remote setup to turn on the Receiver, TV and Apple TV. It also makes for a simple 1 remote setup to turn off the TV, Receiver and sleep the Apple TV.

As a user, I would like to have Home Assistant support sleeping my Apple TV, which would thus turn off my TV & Receiver.

Currently the Apple TV component does not support this.

Operating environment (Hass.io/Docker/Windows/etc.):
Docker

Component/platform:

Only Workaround:
The only workaround presently is a convoluted sequence of left/down/select options in a script; which is not stable (often doesn’t work).

apple_tv_off:
  alias: Apple TV Off
  sequence:
  - data:
      entity_id: media_player.onkyo_receiver_zone2
    service: media_player.turn_off
  - data:
      command: top_menu
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - delay: 0:00:02
  - data:
      command: top_menu
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - delay: 0:00:02
  - data:
      command: left
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - data:
      command: left
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - data:
      command: left
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - data:
      command: left
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - data:
      command: down
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - data:
      command: down
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - data:
      command: down
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - data:
      command: down
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - data:
      command: select
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - delay: 0:00:02
  - data:
      command: down
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - data:
      command: down
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - data:
      command: down
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - data:
      command: down
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - data:
      command: down
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - data:
      command: down
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - data:
      command: down
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - data:
      command: down
      entity_id: remote.living_room_apple_tv
    service: remote.send_command
  - data:
      command: select
      entity_id: remote.living_room_apple_tv
    service: remote.send_command

Relevant configuration.yaml entry:

apple_tv:
  - host: 192.X.X.X
    login_id: !secret apple_tv
    name: Living Room Apple TV
    start_off: true

Additional information:
Is it possible to begin integrating some of the latest changes from here?

Related Issues:



#2

This is one of the most requested features and I would add it directly if someone figured out a way to do it reliably (and working with CEC). But as of today it is not possible AFAIK.