Black
This commit is contained in:
1 parent
da05dfe708
commit
4de97abc3a
2676 files changed
+163166
-140084
No files matched your search
@@ -1,28 +1,33 @@
|
||||
"""Support for device connected via Lightwave WiFi-link hub."""
|
||||
import voluptuous as vol
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.const import (CONF_HOST, CONF_LIGHTS, CONF_NAME,
|
||||
CONF_SWITCHES)
|
||||
from homeassistant.const import CONF_HOST, CONF_LIGHTS, CONF_NAME, CONF_SWITCHES
|
||||
from homeassistant.helpers.discovery import async_load_platform
|
||||
|
||||
LIGHTWAVE_LINK = 'lightwave_link'
|
||||
LIGHTWAVE_LINK = "lightwave_link"
|
||||
|
||||
DOMAIN = 'lightwave'
|
||||
DOMAIN = "lightwave"
|
||||
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema({
|
||||
DOMAIN: vol.Schema(
|
||||
vol.All(cv.has_at_least_one_key(CONF_LIGHTS, CONF_SWITCHES), {
|
||||
vol.Required(CONF_HOST): cv.string,
|
||||
vol.Optional(CONF_LIGHTS, default={}): {
|
||||
cv.string: vol.Schema({vol.Required(CONF_NAME): cv.string}),
|
||||
},
|
||||
vol.Optional(CONF_SWITCHES, default={}): {
|
||||
cv.string: vol.Schema({vol.Required(CONF_NAME): cv.string}),
|
||||
}
|
||||
})
|
||||
)
|
||||
}, extra=vol.ALLOW_EXTRA)
|
||||
CONFIG_SCHEMA = vol.Schema(
|
||||
{
|
||||
DOMAIN: vol.Schema(
|
||||
vol.All(
|
||||
cv.has_at_least_one_key(CONF_LIGHTS, CONF_SWITCHES),
|
||||
{
|
||||
vol.Required(CONF_HOST): cv.string,
|
||||
vol.Optional(CONF_LIGHTS, default={}): {
|
||||
cv.string: vol.Schema({vol.Required(CONF_NAME): cv.string})
|
||||
},
|
||||
vol.Optional(CONF_SWITCHES, default={}): {
|
||||
cv.string: vol.Schema({vol.Required(CONF_NAME): cv.string})
|
||||
},
|
||||
},
|
||||
)
|
||||
)
|
||||
},
|
||||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
@@ -34,12 +39,14 @@ async def async_setup(hass, config):
|
||||
|
||||
lights = config[DOMAIN][CONF_LIGHTS]
|
||||
if lights:
|
||||
hass.async_create_task(async_load_platform(
|
||||
hass, 'light', DOMAIN, lights, config))
|
||||
hass.async_create_task(
|
||||
async_load_platform(hass, "light", DOMAIN, lights, config)
|
||||
)
|
||||
|
||||
switches = config[DOMAIN][CONF_SWITCHES]
|
||||
if switches:
|
||||
hass.async_create_task(async_load_platform(
|
||||
hass, 'switch', DOMAIN, switches, config))
|
||||
hass.async_create_task(
|
||||
async_load_platform(hass, "switch", DOMAIN, switches, config)
|
||||
)
|
||||
|
||||
return True
|
||||
Reference in new issue
Block a user