This commit is contained in:
Paulus Schoutsen committed 2019-07-31 12:25:30 -07:00
1 parent da05dfe708
commit 4de97abc3a
2676 files changed
+163166 -140084

No files matched your search

+28 -21
View File
@@ -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
+4 -5
View File
@@ -1,6 +1,5 @@
"""Support for LightwaveRF lights."""
from homeassistant.components.light import (
ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light)
from homeassistant.components.light import ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light
from homeassistant.const import CONF_NAME
from . import LIGHTWAVE_LINK
@@ -8,8 +7,7 @@ from . import LIGHTWAVE_LINK
MAX_BRIGHTNESS = 255
async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None):
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Find and return LightWave lights."""
if not discovery_info:
return
@@ -69,7 +67,8 @@ class LWRFLight(Light):
if self._brightness != MAX_BRIGHTNESS:
self._lwlink.turn_on_with_brightness(
self._device_id, self._name, self._brightness)
self._device_id, self._name, self._brightness
)
else:
self._lwlink.turn_on_light(self._device_id, self._name)
+1 -2
View File
@@ -5,8 +5,7 @@ from homeassistant.const import CONF_NAME
from . import LIGHTWAVE_LINK
async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None):
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Find and return LightWave switches."""
if not discovery_info:
return