Use voluptuous for Command line platforms (#2968)
* Migrate to voluptuous * Fix pylint issues * Remove FIXME * Split setup test * Test with bootstrap * Remove lon and lat * Fix pylint issues
This commit is contained in:
parent
81628b01c2
commit
40c71b5d96
11 changed files with 199 additions and 134 deletions
|
@ -6,21 +6,25 @@ https://home-assistant.io/components/notify.command_line/
|
|||
"""
|
||||
import logging
|
||||
import subprocess
|
||||
from homeassistant.helpers import validate_config
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (CONF_COMMAND, CONF_NAME)
|
||||
from homeassistant.components.notify import (
|
||||
DOMAIN, BaseNotificationService)
|
||||
BaseNotificationService, PLATFORM_SCHEMA)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Required(CONF_COMMAND): cv.string,
|
||||
vol.Optional(CONF_NAME): cv.string,
|
||||
})
|
||||
|
||||
|
||||
def get_service(hass, config):
|
||||
"""Get the Command Line notification service."""
|
||||
if not validate_config({DOMAIN: config},
|
||||
{DOMAIN: ['command']},
|
||||
_LOGGER):
|
||||
return None
|
||||
|
||||
command = config['command']
|
||||
command = config[CONF_COMMAND]
|
||||
|
||||
return CommandLineNotificationService(command)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue