Yes, this question has been asked and there’s a feature request, but these older posts all detail remote sequences to launch apps. The ability to launch apps directly (using a command) has been added recently. I’ve been a user of both the bundled Apple TV integration and the beta integration. As of late (due to bugs and new features after the launch of tvOS 15), I’ve been using the beta integration (currently v2.2.0).
I’ve been trying to understand better what is needed in order to use this new feature and the info I could find was slim. My understanding is as follows:
- You need tvOS 15 (I’m running 15.1.1).
- You need to have paired as a companion (vs MRP, RAOP, Airplay).
The former is easy to check. The latter wasn’t clear to me, as within HA, I don’t think you control or know which protocol gets used.
I’ve been using the atvremote
utility directly in order to understand this better. Note that I’m running HA core in a virtualenv, which means I ran source bin/activate
, a typical Python venv command, to switch to the HA environtment.
- I explicitly paired using the companion protocol.
- You can see which apps supports this by providing the
app_list
command. - You can launch an app using the
launch_app
command.
To pair (I saved the output to a file called companion.cred
):
atvremote -i <redacted> --protocol companion pair
One can check that the companion protocol is supported for your device by running a scan:
atvremote scan
Partial example output:
Services:
- Protocol: Companion, Port: 49153, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
- Protocol: AirPlay, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
- Protocol: MRP, Port: 49152, Credentials: None, Requires Password: False, Password: None, Pairing: Optional (Disabled)
- Protocol: RAOP, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
For example, I get some apps with this:
atvremote --id <redacted> --companion-credentials `cat companion.cred` app_list
Example output:
App: Red Bull TV (com.nousguide.rbms), App: DStv (com.multichoice.dstvguideipad), App: Podcasts (com.apple.podcasts), App: Movies (com.apple.TVMovies), App: Prime Video (com.amazon.aiv.AIVApp), App: TV (com.apple.TVWatchList), App: Photos (com.apple.TVPhotos), App: Clock and Timer (com.ryanoconnor.tvclock), App: App Store (com.apple.TVAppStore), App: Arcade (com.apple.Arcade), App: NBC (com.nbcuni.nbc.portal), App: Search (com.apple.TVSearch), App: Radio Paradise (it.iltofa.RP-HD), App: Computers (com.apple.TVHomeSharing), App: YouTube (com.google.ios.youtube), App: Showmax (com.showmax.main), App: Plex (com.plexapp.plex), App: Settings (com.apple.TVSettings), App: Apple Events (com.apple.appleevents), App: Netflix (com.netflix.Netflix), App: Music (com.apple.TVMusic)
To launch an app:
atvremote --id <redacted> --companion-credentials `cat ~/companion.cred` launch_app=com.apple.TVMovies
Where com.apple.TVMovies
is the bundle ID from the app_list
from before (and the app name is just Movies).
At this point, you have all the information to launch an app from HA. In HA, however, don’t use the bundle ID, but rather the app name.
service: media_player.select_source
target:
entity_id: media_player.my_living_room
data:
source: Movies
It would be useful to know how users not running pure HA core should determine the apps, without guessing, and from within HA.
From the GitHub release log (for v2.1.0):
Support for launching apps! Use
select_source
or the media browser. Only works on devices running tvOS and if Companion has been paired. If apps aren’t shown, remove and add the device again and make sure that the Companion protocol is paired.