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

Use voluptuous for webostv #3135

Merged
merged 1 commit into from
Sep 2, 2016
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
27 changes: 12 additions & 15 deletions homeassistant/components/notify/webostv.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,30 @@
"""
import logging

from homeassistant.components.notify import (BaseNotificationService, DOMAIN)
from homeassistant.const import (CONF_HOST, CONF_NAME)
from homeassistant.helpers import validate_config
import voluptuous as vol

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'
'/archive/v0.1.2.zip'
'#pylgtv==0.1.2']

_LOGGER = logging.getLogger(__name__)

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_HOST): cv.string,
})


def get_service(hass, config):
"""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 PyLGTVPairException

client = WebOsClient(host)
client = WebOsClient(config.get(CONF_HOST))

try:
client.register()
Expand Down