Apple TV 4K IP Command Solution

Share any commands you know or look here to find commands for your devices.
Post Reply
flinke flasche
Posts: 60
Joined: Tue Apr 02, 2013 2:21 pm

Apple TV 4K IP Command Solution

Post by flinke flasche » Tue Sep 29, 2020 6:35 pm

Hi,

i want to show you my solution to control my Apple TV 4K running osTV14.
All you need is an Raspberry Pi. Maybe you have one for your home automation.
Unfortunately it's not possible to control Siri :(

First you have to install homebridge on your Raps.
I think when you own one you know how to do it.

After you installed homebridge you have to install a plugin form the plugin browser in homebridge.
type in your IP of your raspi and login in homebridge. Then go to the Plugin Tab and browse for "Apple TV"
Install "Homebridge Apple Tv Remote"

After install login on your Raps over ssh.
I use Mac Terminal ssh pi@192.xxx.xxx.xxx
Password: raspberry

You can see the documentation here on github
After login type: appletv pair
You must enter the PIN your Apple TV shows on the screen.
After that you get a very long Credentials. Copy it and paste it into the settings in the Homebridge Plugin.
Fill the other with * marked fields.
Enable the Api. You need a Port number (your choice) and a Token (your choice as well).

Save and restart homebridge.

Try to control your Apple TV 4K with the following command in Demopad for play.
GET /<YOUR DEVICE NAME>/set?pressKey=play&token=<YOUR TOKEN> HTTP/1.0\x0D\x0A

you can also use a long press by using the next command for the standby menu.
GET /<YOUR DEVICE NAME>/set?longPressKey=topmenu&token=<YOUR TOKEN> HTTP/1.0\x0D\x0A

You can see a working command in the homebridge status like
[9/29/2020, 18:40:25] [Kammer1] [AppleTV-Remote] Pressing key topmenu...

the complete list of commands you can find on GitHub (link above).

Have fun with it.

manaman
Posts: 22
Joined: Sun Mar 19, 2017 12:19 pm

Re: Apple TV 4K IP Command Solution

Post by manaman » Sat Oct 17, 2020 3:39 pm

This is great, thank you! I installed Homebridge on a Mac mini also, which runs fine. However I got to the stage to scan for Apple TVs and it keeps saying 'No Apple TVs on network, try again." so I can't get the ID of the Apple TV to add to Homebridge (I only have one Apple TV). Any ideas why it won't see the Apple TV?

manaman
Posts: 22
Joined: Sun Mar 19, 2017 12:19 pm

Re: Apple TV 4K IP Command Solution

Post by manaman » Sat Oct 17, 2020 9:41 pm

Ignore previous question, after a few scans it finally found my Apple TV. I have another question though - do you find there is a delay between sending a command and it being executed on the Apple TV? I'm seeing about a 2 second delay. Also could you please tell me the correct http command to launch an app (provided I have the correct identifier per the Github page)? Thanks for any advice...

Post Reply