Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove turn_on and turn_off feature for clients #18234

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 17 additions & 2 deletions homeassistant/components/media_player/directv.py
Expand Up @@ -36,6 +36,10 @@
SUPPORT_PLAY_MEDIA | SUPPORT_SELECT_SOURCE | SUPPORT_STOP | \
SUPPORT_NEXT_TRACK | SUPPORT_PREVIOUS_TRACK | SUPPORT_PLAY

SUPPORT_DTV_CLIENT = SUPPORT_PAUSE | \
SUPPORT_PLAY_MEDIA | SUPPORT_SELECT_SOURCE | SUPPORT_STOP | \
SUPPORT_NEXT_TRACK | SUPPORT_PREVIOUS_TRACK | SUPPORT_PLAY

DATA_DIRECTV = 'data_directv'

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
Expand Down Expand Up @@ -126,10 +130,15 @@ def __init__(self, name, host, port, device):
self._paused = None
self._last_position = None
self._is_recorded = None
self._is_client = device != '0'
self._assumed_state = None
self._available = False

_LOGGER.debug("Created DirecTV device for %s", self._name)
if self._is_client:
_LOGGER.debug("Created DirecTV client %s for device %s",
self._name, device)
else:
_LOGGER.debug("Created DirecTV device for %s", self._name)

def update(self):
"""Retrieve latest state."""
Expand Down Expand Up @@ -290,7 +299,7 @@ def source(self):
@property
def supported_features(self):
"""Flag media player features that are supported."""
return SUPPORT_DTV
return SUPPORT_DTV_CLIENT if self._is_client else SUPPORT_DTV

@property
def media_currently_recording(self):
Expand Down Expand Up @@ -327,11 +336,17 @@ def media_start_time(self):

def turn_on(self):
"""Turn on the receiver."""
if self._is_client:
raise NotImplementedError()

_LOGGER.debug("Turn on %s", self._name)
self.dtv.key_press('poweron')

def turn_off(self):
"""Turn off the receiver."""
if self._is_client:
raise NotImplementedError()

_LOGGER.debug("Turn off %s", self._name)
self.dtv.key_press('poweroff')

Expand Down