This repository includes a Python CLI to pair, connect, and perform automations for events for Apple TVs on your local network by utilizing the pyatv library.
Some barebones listeners classes are included. There is also a basic function named publish_event_to_ifttt_webhooks()
in utils.py which enables IFTTT Webhooks integrations.
The motivation behind this project was to enable running IFTTT applets when an Apple TV powered on or off. However, it has been written in a way which should make it extensible for other purposes. For example, you could perform some action when a movie starts playing. Please refer to the pyatv documentation for information about available listeners.
- Python 3.7+
- Additional libraries defined in requirements.txt
- OpenSSL compiled with support for ed25519 in order to connect to MRP devices (more info)
-
Clone this repository:
git clone https://github.com/bstein/appletv-automate.git
-
Install dependencies:
pip install -r requirements.txt
-
Copy
config-sample.py
toconfig.py
and updateIFTTT_API_KEY
, should you wish to use it. -
Open
main.py
and find the# TODO
comment. By default, thePowerListener
is uncommented. Comment/uncomment the other listeners based on which ones you would like to use. You will likely want to tweak the listener classes to fit your needs, but you may use them as-is for now. -
Start
main.py
python main.py