Start | Scan, Pair and Connect | Device Information | Control | Power Management | Features | Metadata | Listeners | Stream | Storage | Apps | Audio | Keyboard | Logging | Examples

Keyboard

It is possible to interact with the Apple TV virtual keyboard via the Keyboard interface. To use this interface, the Companion protocol must be available.

Using the Keyboard API

After connecting to a device, you get the keyboard interface via interface.AppleTV.keyboard:

atv = await pyatv.connect(config, ...)
keyboard = atv.keyboard

To check whether the virtual keyboard is focused and active, use interface.Keyboard.text_focus_state:

print("Keyboard focus state:", keyboard.text_focus_state)

To fetch the current virtual keyboard text content, use interface.Keyboard.text_get:

print("Keyboard text:", await keyboard.text_get())

To set (replace) the virtual keyboard text, use interface.Keyboard.text_set:

await keyboard.text_set("text to set")

To append to the virtual keyboard text, use interface.Keyboard.text_append:

await keyboard.text_append("text to append")

Finally, to clear the virtual keyboard text, use interface.Keyboard.text_clear:

await keyboard.text_clear()

The keyboard API supports push updates via a listener, as described here.

← Audio | Logging →