Switching from iOS to Android meant that I could not easily control my Apple TV, so I built my own remote! I showed it in this video.
It’s very easy to build yourself and will work on any phone, tablet, or desktop. You do not need an Apple, TV but this will be using Home Assistant.
Table of Contents
Custom Subview
The first thing to do is create a new view on the dashboard. To do that, click on the “pencil icon” button to edit the dashboard. Then click on the “plus button” at the top to create a new view.
I would recommend turning on “Subview”. This will allow you to go into this view from any dashboard. Then when you don’t need to use the remote anymore, there’s a back arrow that will take you to the previous dashboard you were at.
What you will definitely need to do is click on “Section (experimental)” under the View type. This will allow drag and drop and make life much easier.
Next you will need a button to get to the subview if you decided to use it. I created a badge at the top of my main dashboard because I use it so often. Here is a screenshot of how the badge is configured and the code.
type: entity
show_name: true
show_state: false
show_icon: true
entity: sensor.time
icon: mdi:remote-tv
color: accent
tap_action:
action: navigate
navigation_path: /lovelace-dash/remote_family_room
name: Remote
For the entity I’m using “time.” That might seem weird, but it is always on and that means the badge button will always be the color I want. You can put any entity in there. The important part is the action when it’s clicked, and make sure to choose Navigate and add the path to the subview. If you don’t know the path to the subview, just go to the subview in a browser and look at the URL.
Now it’s time to create a button for the remote. You can use the Button card but I choose the Tile card. The reason for that is I can change the color of the icon.
I know there are community add-ons to change the button card, but I was feeling lazy at the time. I created this entire dashboard on my phone while watching TV so I was going for the fastest and easiest way. What card you use or how you style it is 100% personal choice on what you like!
For the Tile card, I just made the Icon the arrow of the button or whatever seemed fitting for the button. Here is how I changed the Icon and color. I also used it in Vertical and hid the state.
Then for the action, make sure to use Remote Send Command. For the command it is just “up” since it’s an up arrow. If you are using an Apple TV, here are all the commands for the remote.
If you want all the code for one button, here it is.
type: tile
entity: remote.family_room_tv
tap_action:
action: perform-action
perform_action: remote.send_command
target:
entity_id: remote.family_room_tv
data:
hold_secs: 0
command: up
icon: mdi:arrow-up-bold
vertical: true
hide_state: true
name: ' '
show_entity_picture: false
layout_options:
grid_columns: 1
grid_rows: 2
icon_tap_action:
action: perform-action
perform_action: remote.send_command
target:
entity_id: remote.family_room_tv
data:
hold_secs: 0
command: up
color: accent
Once you have made one button, it’s super easy to make more. All you have to do is duplicate the card and swap out the icon and command. Probably the most difficult part is just deciding which icon to use!
Oh and one of the tricky commands was the back arrow on the Apple TV remote. For that command, it was just “menu.” So hopefully that’s helpful.
Here is what my layout looks like after I added everything.
I have a few more buttons that don’t just do a simple TV remote command. One button skips ahead on commercials. For that button, I have the action call a script since it does two remote commands.
The script is very similar to the buttons above. It starts with pressing the select button first and then the right button 15 times.
Here is the code for the script, and you can see it’s pretty simple.
alias: Skip TV commercials family room tv
sequence:
- action: remote.send_command
metadata: {}
data:
command: select
target:
entity_id: remote.family_room_tv
- action: remote.send_command
metadata: {}
data:
command: right
num_repeats: 15
target:
entity_id: remote.family_room_tv
description: ""
icon: mdi:debug-step-over
The other type of button I have on the remote is one that jumps into specific apps on the Apple TV, like YouTube TV or Netflix.
Here is what the action of the button looks like.
Also the code for the button.
type: tile
entity: media_player.family_room_tv_2
name: YouTube TV
icon: mdi:youtube-tv
hide_state: true
tap_action:
action: perform-action
perform_action: media_player.select_source
target:
entity_id: media_player.family_room_tv_2
data:
source: YouTube TV
color: white
icon_tap_action:
action: perform-action
perform_action: media_player.select_source
target:
entity_id: media_player.family_room_tv_2
data:
source: YouTube TV
Just change the source for each of the different apps on the Apple TV. Here is a list of the ones I use.
YouTube
YouTube TV
Max
Netflix
Plex
Spotify
PBS KIDS
Prime Video
The were some icons not available with the default Home Assistant, so the Custom Brand Icons came in clutch for lots of options!
Here is what my other section of the remote looks like.
Oh and I forgot to talk about the Reload button in the video. If the Apple TV integration becomes unavailable, I have a button to quickly reload that configuration. Here is the action for that.
metadata: {}
data: {}
target:
entity_id:
- media_player.family_room_tv_2
action: homeassistant.reload_config_entry
Automations
I also have an automation that reloads the Apple TV configuration in Home Assistant if it becomes unavailable. I don’t know why this isn’t always an automatic thing but this automation keeps the Apple TV connected 99% of the time.
alias: Reboot Apple TV config if unavailable
description: ""
trigger:
- platform: state
entity_id:
- media_player.family_room_tv_2
to: unavailable
condition: []
action:
- metadata: {}
data: {}
target:
entity_id:
- media_player.family_room_tv_2
action: homeassistant.reload_config_entry
mode: single
For the kid out of bed automation that turns off the TV using the motion sensors, all it does is send the remote command “pause” and then suspend. Here is the code.
alias: Kid TV alert triggered
description: Kid is out of bed so pause the TV
trigger:
- type: motion
platform: device
device_id: b8262048d8de87c35bdc49f2536bf9a9
entity_id: e054a24b4cc1ad58c3041ec8061024d7
domain: binary_sensor
- type: motion
platform: device
device_id: 2d980fcd07f0deddfb61e80371fcc98b
entity_id: dd3ce90dad9a54af85fdbe431463c5cc
domain: binary_sensor
condition:
- condition: state
entity_id: input_boolean.kid_tv_alert
state: "on"
- condition: state
entity_id: media_player.family_room_tv_2
state: playing
action:
- action: remote.send_command
metadata: {}
data:
command: pause
target:
entity_id: remote.family_room_tv
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- action: remote.send_command
metadata: {}
data:
command: suspend
target:
entity_id: remote.family_room_tv
mode: single
If you want to see how my lights automatically change using just the play and pause on the Apple TV then check out the video I made on it!