Controlling Apple TV with pyatv
25 Jan 2024.
pyatv is an open-source tool (MIT license) for controlling Apple TV devices over the network. It uses AirPlay and other network protocols supported by the Apple TV. The most relevant features for us are: Listing the installed apps, launching an app, and sending text to the on-screen keyboard.
These were always possible to do with Stb-tester, by navigating the relevant AppleTV screens, but pyatv is much faster because it doesn’t require navigation:
Action | Stb-tester | pyatv |
---|---|---|
Launch an app | Navigate the AppleTV home grid | Send the command over the network |
Enter text | Navigate the on-screen keyboard | Send the entire text over the network |
For usage, configuration and installation instructions, see Controlling Apple TV with pyatv in the Stb-tester manual.