|
|
|
@ -1,9 +1,7 @@
|
|
|
|
|
"""
|
|
|
|
|
Support for LG TV from 2011
|
|
|
|
|
|
|
|
|
|
For more details about this platform, please refer to the documentation at
|
|
|
|
|
TBA
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from datetime import timedelta
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
|
@ -11,7 +9,7 @@ from requests import RequestException
|
|
|
|
|
import voluptuous as vol
|
|
|
|
|
|
|
|
|
|
from homeassistant import util
|
|
|
|
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
|
|
|
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
|
|
|
|
|
from homeassistant.components.media_player.const import (
|
|
|
|
|
MEDIA_TYPE_CHANNEL,
|
|
|
|
|
SUPPORT_NEXT_TRACK,
|
|
|
|
@ -24,12 +22,16 @@ from homeassistant.components.media_player.const import (
|
|
|
|
|
SUPPORT_VOLUME_STEP,
|
|
|
|
|
)
|
|
|
|
|
from homeassistant.const import (
|
|
|
|
|
CONF_ACCESS_TOKEN, CONF_HOST, CONF_NAME, STATE_OFF, STATE_PAUSED,
|
|
|
|
|
STATE_PLAYING, STATE_UNKNOWN)
|
|
|
|
|
CONF_ACCESS_TOKEN,
|
|
|
|
|
CONF_HOST,
|
|
|
|
|
CONF_NAME,
|
|
|
|
|
STATE_OFF,
|
|
|
|
|
STATE_PAUSED,
|
|
|
|
|
STATE_PLAYING,
|
|
|
|
|
STATE_UNKNOWN,
|
|
|
|
|
)
|
|
|
|
|
import homeassistant.helpers.config_validation as cv
|
|
|
|
|
|
|
|
|
|
REQUIREMENTS = []#'pylgnetcast-homeassistant==0.2.0.dev0']
|
|
|
|
|
|
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
DEFAULT_NAME = 'LG TV Remote'
|
|
|
|
@ -59,7 +61,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|
|
|
|
add_entities([LgTVDevice(host, access_token, name)], True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LgTVDevice(MediaPlayerDevice):
|
|
|
|
|
class LgTVDevice(MediaPlayerEntity):
|
|
|
|
|
"""Representation of a LG TV."""
|
|
|
|
|
|
|
|
|
|
def __init__(self, host, access_token, name):
|
|
|
|
|