I came across pyatv (https://pyatv.dev), a python client library to read and control an Apple TV.
It is very simple to install with
- Code: Select all
pip install pyatv
Second step is pairing, which is quite easy, too. After that you are in business, and you can start bossing your AppleTV around.
To play around with it, I currently have a very simple (very dirty!) python script combined with an Indigo variable and trigger. I put a new command into the variable, and it is sent to the appleTV. I need to figure out how to do this in a better way, and more importantly: how to receive events from the AppleTV. A simple plugin is probably enough but I have never written one.
- Code: Select all
import subprocess
var = indigo.variables[352797377] # AppleTVCommand
command = "/Library/Frameworks/Python.framework/Versions/3.9/bin/atvremote --id C8:69:CD:4D:75:49 --mrp-credentials `cat /Users/media/.appleTVcredentials` " + var.value
proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
out, err = proc.communicate()
indigo.server.log(u"command error: %s" % err)
indigo.server.log("Sent AppleTV command %s" % var.value)
Anyhow, thought I would share the find!
EDIT: corrected typo in title