Nodes for controlling Apple TVs in Node-RED (wrapper pyatv).
Thanks Pierre Ståhl for project pyatv
Tested models are:
$ sudo apt-get install build-essential libssl-dev libffi-dev python3-dev python3-pip python3-cryptography python3-wheel
$ sudo pip3 install --upgrade pyatv
$ docker exec -it --user root mynodered bash
in docker
docker$ apk add openssl-dev libffi-dev python3-dev py3-pip
docker$ pip3 install --upgrade wheel
docker$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rust.sh && sh rust.sh -y && rm rust.sh && source $HOME/.cargo/env
docker$ pip3 install --upgrade pyatv
Creation of virtual environments then in node OUT set Path where atvremote/atvscript
$ atvremote --id 00:11:22:33:44:54 --protocol companion pair
$ atvremote --id 00:11:22:33:44:54 --protocol airplay pair
A very simple node that takes the following commands as a string on msg.payload
Usage play_url=https://www.example.com/mymovie.mp4
Usage stream_file=/tmp/myfile.mp4
Usage launch_app=com.netflix.Netflix
Usage set_volume=100
Events from Apple TV on msg.payload
{
dateTime: null,
hash: null,
mediaType: null,
deviceState: null,
title: null,
artist: null,
album: null,
genre: null,
totalTime: null,
position: null,
shuffle: null,
repeat: null,
app: null,
appId: null,
powerState: null
}