Controlling a device is done with the remote control interface, interface.RemoteControl. It allows you navigate the menus and change playback (play, pause, etc.).
Using the Remote Control API
After connecting to a device, you get the remote control via interface.AppleTV.remote_control:
atv = await pyatv.connect(config, ...) rc = atv.remote_control
You can then control via the available functions:
await rc.up() await rc.select() await rc.volume_up() await rc.set_position(100)
All available actions can be found in interface.RemoteControl.
Currently three types of input actions are supported:
- Single tap (“click”)
- Double tap (“double click”)
These actions are supported by the following buttons:
- Arrow keys (up, down, left, right)
By default, const.InputAction.SingleTap are used. Pass another
to use another input action:
await rc.menu(action=InputAction.Hold) await rc.home(action=InputAction.DoubleTap)
All input actions are specified in const.InputAction.