Apple TV Integration into Home Assistant (2020.12.1) Release


In the new version of home assistant at the time of writing (2020.12.1) Apple TV integration is back working again, since the TVOS 13 update it broke the old mechanism home assistant used.

Now it is possible to integrate Apple TV in home Assistant in the integration page.

 

I made a video on Youtube with detailed instructions with a couple of automation ideas too:

 

Once integrated you will have a media player entity and a remote entity.

The media player entity displays what is currently running on your Apple TV, with remote you can send commands like left, right, up and down.

 

In this post I’m going to give you two use cases that you can use

 

Stream baby monitor on Apple TV when motion is detected and baby is sleeping

To accomplish this we need:

  • Apple TV
  • IP Camera integrated into HA
  • Motion sensor in the room
  • An Input boolean that can set if the baby is sleeping or not.

 

This is the code that you will need remember to substitute your entity_ids in the code

Helper:

 

input_boolean:
  baby_asleep:
    name: Notify when someone arrives home
    icon: mdi:baby

 

Automation:

 

alias: Stream Baby Monitor on Apple TV

trigger:
  platform: state
  entity_id: binary_sensor.landing_sensor_2_motion
action:
  service: camera.play_stream
  entity_id: camera.uvc_flex
  data:
    entity_id: camera.uvc_flex
    media_player: media_player.atv
condition:
  condition: state
  entity_id:
    input_boolean.baby_asleep
  state: 'on'

 

Activate Scene when movie is playing on Apple TV after sunset

This will set the right tone for movie night after a long day.

First of all create a scene, you can do this on the UI or in the scenes.yaml, below you can find the code:

name: Living Room Movie
  entities:
    light.living_2:
      min_mireds: 153
      max_mireds: 500
      effect_list:
      - colorloop
      - random
      brightness: 15
      color_temp: 309
      effect: none
      friendly_name: Living 2
      supported_features: 63
      state: 'on'
    light.living_1:
      min_mireds: 153
      max_mireds: 500
      effect_list:
      - colorloop
      - random
      friendly_name: Living 1
      supported_features: 63
      state: 'off'
    light.lidl_lamp1:
      min_mireds: 140
      max_mireds: 650
      effect_list:
      - colorloop
      brightness: 51
      color_temp: 364
      is_deconz_group: false
      friendly_name: Lidl Lamp 1
      supported_features: 63
      state: 'on'
    light.lidl_lamp2:
      min_mireds: 140
      max_mireds: 650
      effect_list:
      - colorloop
      brightness: 43
      color_temp: 350
      is_deconz_group: false
      friendly_name: Lidl Lamp 2
      supported_features: 63
      state: 'on'
    light.hue_white_candle_2:
      brightness: 48
      friendly_name: Lamp 2
      supported_features: 41
      state: 'on'
  icon: mdi:movie

 

Then we need to create an automation to trigger the code:

  alias: Trigger Movie Scene

  trigger:
  - platform: state
    entity_id: media_player.atv
    to: 'on'
  - platform: state
    entity_id: media_player.plex_plex_for_apple_tv_living_room
    to: 'on'
  condition:
  - condition: sun
    after: sunset
    before: sunrise
  action:
  - scene: scene.living_room_movie
  mode: single

 

Gio

Gio loves rabbits, smart home tech, WWII, travelling to Thailand & my favourite pizza is margherita with parma ham!

Recent Posts