mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 17:57:55 +00:00
Use voluptuous for webostv (#3135)
This commit is contained in:
parent
28e939afcf
commit
81628b01c2
@ -6,33 +6,30 @@ https://home-assistant.io/components/notify.webostv/
|
|||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.components.notify import (BaseNotificationService, DOMAIN)
|
import voluptuous as vol
|
||||||
from homeassistant.const import (CONF_HOST, CONF_NAME)
|
|
||||||
from homeassistant.helpers import validate_config
|
|
||||||
|
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.components.notify import (BaseNotificationService,
|
||||||
|
PLATFORM_SCHEMA)
|
||||||
|
from homeassistant.const import CONF_HOST
|
||||||
|
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
REQUIREMENTS = ['https://github.com/TheRealLink/pylgtv'
|
REQUIREMENTS = ['https://github.com/TheRealLink/pylgtv'
|
||||||
'/archive/v0.1.2.zip'
|
'/archive/v0.1.2.zip'
|
||||||
'#pylgtv==0.1.2']
|
'#pylgtv==0.1.2']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
|
||||||
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||||
|
vol.Required(CONF_HOST): cv.string,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
def get_service(hass, config):
|
def get_service(hass, config):
|
||||||
"""Return the notify service."""
|
"""Return the notify service."""
|
||||||
if not validate_config({DOMAIN: config}, {DOMAIN: [CONF_HOST, CONF_NAME]},
|
|
||||||
_LOGGER):
|
|
||||||
return None
|
|
||||||
|
|
||||||
host = config.get(CONF_HOST, None)
|
|
||||||
|
|
||||||
if not host:
|
|
||||||
_LOGGER.error('No host provided.')
|
|
||||||
return None
|
|
||||||
|
|
||||||
from pylgtv import WebOsClient
|
from pylgtv import WebOsClient
|
||||||
from pylgtv import PyLGTVPairException
|
from pylgtv import PyLGTVPairException
|
||||||
|
|
||||||
client = WebOsClient(host)
|
client = WebOsClient(config.get(CONF_HOST))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client.register()
|
client.register()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user