Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pyatv/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,12 @@ class FeatureName(Enum):
Click = 65
"""Touch click command."""

Guide = 66
"""Show EPG."""

ControlCenter = 68
"""Open the Control Center."""


class TouchAction(Enum):
"""Touch action constants."""
Expand Down
10 changes: 10 additions & 0 deletions pyatv/core/facade.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ async def screensaver(self) -> None:
"""Activate screen saver.."""
return await self.relay("screensaver")()

@shield.guard
async def guide(self) -> None:
"""Show EPG."""
return await self.relay("guide")()

@shield.guard
async def control_center(self) -> None:
"""Open the control center."""
return await self.relay("control_center")()


class FacadeMetadata(Relayer, interface.Metadata):
"""Facade implementation for retrieving metadata from an Apple TV."""
Expand Down
10 changes: 10 additions & 0 deletions pyatv/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,16 @@ async def screensaver(self) -> None:
"""Activate screen saver.."""
raise exceptions.NotSupportedError()

@feature(66, "Guide", "Show EPG.")
async def guide(self) -> None:
"""Show EPG."""
raise exceptions.NotSupportedError()

@feature(68, "ControlCenter", "Control Center.")
async def control_center(self) -> None:
"""Open the control center."""
raise exceptions.NotSupportedError()


# TODO: Should be made into a dataclass when support for 3.6 is dropped
class Playing(ABC):
Expand Down
10 changes: 10 additions & 0 deletions pyatv/protocols/companion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ class MediaControlFlags(IntFlag):
FeatureName.ChannelUp,
FeatureName.ChannelDown,
FeatureName.Screensaver,
FeatureName.Guide,
FeatureName.ControlCenter,
# Keyboard interface
FeatureName.TextFocusState,
FeatureName.TextGet,
Expand Down Expand Up @@ -380,6 +382,14 @@ async def screensaver(self) -> None:
"""Activate screen saver."""
await self._press_button(HidCommand.Screensaver)

async def guide(self) -> None:
"""Show EPG."""
await self._press_button(HidCommand.Guide)

async def control_center(self) -> None:
"""Open the control center."""
await self._press_button(HidCommand.PageDown)

async def _press_button(
self,
command: HidCommand,
Expand Down
2 changes: 2 additions & 0 deletions tests/fake_device/companion.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
HidCommand.ChannelIncrement: "channel_up",
HidCommand.ChannelDecrement: "channel_down",
HidCommand.Screensaver: "screensaver",
HidCommand.Guide: "guide",
HidCommand.PageDown: "control_center",
}

MEDIA_CONTROL_MAP = {
Expand Down
2 changes: 2 additions & 0 deletions tests/protocols/companion/test_companion_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ async def test_session_start_and_stop(companion_client, companion_state):
"play_pause",
"channel_up",
"channel_down",
"guide",
"control_center",
# Media Control
"play",
"pause",
Expand Down