Skip to content
Merged
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
19 changes: 19 additions & 0 deletions homeassistant/components/roku/media_player.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Support for the Roku media player."""
import logging

from requests.exceptions import (
ConnectionError as RequestsConnectionError,
ReadTimeout as RequestsReadTimeout,
Expand All @@ -7,9 +9,11 @@

from homeassistant.components.media_player import MediaPlayerDevice
from homeassistant.components.media_player.const import (
MEDIA_TYPE_CHANNEL,
MEDIA_TYPE_MOVIE,
SUPPORT_NEXT_TRACK,
SUPPORT_PLAY,
SUPPORT_PLAY_MEDIA,
SUPPORT_PREVIOUS_TRACK,
SUPPORT_SELECT_SOURCE,
SUPPORT_TURN_OFF,
Expand All @@ -21,13 +25,16 @@

from .const import DATA_CLIENT, DEFAULT_MANUFACTURER, DEFAULT_PORT, DOMAIN

_LOGGER = logging.getLogger(__name__)

SUPPORT_ROKU = (
SUPPORT_PREVIOUS_TRACK
| SUPPORT_NEXT_TRACK
| SUPPORT_VOLUME_SET
| SUPPORT_VOLUME_MUTE
| SUPPORT_SELECT_SOURCE
| SUPPORT_PLAY
| SUPPORT_PLAY_MEDIA
| SUPPORT_TURN_ON
| SUPPORT_TURN_OFF
)
Expand Down Expand Up @@ -217,6 +224,18 @@ def volume_down(self):
if self.current_app is not None:
self.roku.volume_down()

def play_media(self, media_type, media_id, **kwargs):
"""Tune to channel."""
if media_type != MEDIA_TYPE_CHANNEL:
_LOGGER.error(
"Invalid media type %s. Only %s is supported",
media_type,
MEDIA_TYPE_CHANNEL,
)
return
if self.current_app is not None:
self.roku.launch(self.roku["tvinput.dtv"], {"ch": media_id})

def select_source(self, source):
"""Select input source."""
if self.current_app is not None:
Expand Down