Add voluptuous to wemo. (#2895)

This commit is contained in:
Greg Dowling 2016-08-20 13:03:57 +01:00 committed by Fabian Affolter
parent 6e672b7bee
commit 482f32bb87

View File

@ -6,8 +6,12 @@ https://home-assistant.io/components/wemo/
""" """
import logging import logging
import voluptuous as vol
from homeassistant.components.discovery import SERVICE_WEMO from homeassistant.components.discovery import SERVICE_WEMO
from homeassistant.helpers import discovery from homeassistant.helpers import discovery
from homeassistant.helpers import config_validation as cv
from homeassistant.const import EVENT_HOMEASSISTANT_STOP from homeassistant.const import EVENT_HOMEASSISTANT_STOP
REQUIREMENTS = ['pywemo==0.4.5'] REQUIREMENTS = ['pywemo==0.4.5']
@ -29,6 +33,14 @@ KNOWN_DEVICES = []
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
CONF_STATIC = 'static'
CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({
vol.Optional(CONF_STATIC, default=[]): vol.Schema([cv.string])
}),
}, extra=vol.ALLOW_EXTRA)
# pylint: disable=unused-argument, too-many-function-args # pylint: disable=unused-argument, too-many-function-args
def setup(hass, config): def setup(hass, config):
@ -69,7 +81,7 @@ def setup(hass, config):
# Add static devices from the config file. # Add static devices from the config file.
devices.extend((address, None) devices.extend((address, None)
for address in config.get(DOMAIN, {}).get('static', [])) for address in config.get(DOMAIN, {}).get(CONF_STATIC))
for address, device in devices: for address, device in devices:
port = pywemo.ouimeaux_device.probe_wemo(address) port = pywemo.ouimeaux_device.probe_wemo(address)