mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Migrate to voluptuous (#3337)
This commit is contained in:
parent
1e8cf8c1b7
commit
79bff0fc57
@ -9,25 +9,19 @@ import socket
|
|||||||
import random
|
import random
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import util
|
from homeassistant import util
|
||||||
from homeassistant.const import CONF_HOST
|
from homeassistant.const import CONF_HOST
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
Light,
|
Light, ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_RGB_COLOR,
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_TRANSITION, EFFECT_RANDOM, SUPPORT_BRIGHTNESS, SUPPORT_EFFECT,
|
||||||
ATTR_COLOR_TEMP,
|
SUPPORT_COLOR_TEMP, SUPPORT_RGB_COLOR, SUPPORT_TRANSITION, PLATFORM_SCHEMA)
|
||||||
ATTR_EFFECT,
|
import homeassistant.helpers.config_validation as cv
|
||||||
ATTR_RGB_COLOR,
|
|
||||||
ATTR_TRANSITION,
|
REQUIREMENTS = ['lightify==1.0.3']
|
||||||
EFFECT_RANDOM,
|
|
||||||
SUPPORT_BRIGHTNESS,
|
|
||||||
SUPPORT_EFFECT,
|
|
||||||
SUPPORT_COLOR_TEMP,
|
|
||||||
SUPPORT_RGB_COLOR,
|
|
||||||
SUPPORT_TRANSITION,
|
|
||||||
)
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
REQUIREMENTS = ['lightify==1.0.3']
|
|
||||||
|
|
||||||
TEMP_MIN = 2000 # lightify minimum temperature
|
TEMP_MIN = 2000 # lightify minimum temperature
|
||||||
TEMP_MAX = 6500 # lightify maximum temperature
|
TEMP_MAX = 6500 # lightify maximum temperature
|
||||||
@ -40,9 +34,13 @@ SUPPORT_OSRAMLIGHTIFY = (SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP |
|
|||||||
SUPPORT_EFFECT | SUPPORT_RGB_COLOR |
|
SUPPORT_EFFECT | SUPPORT_RGB_COLOR |
|
||||||
SUPPORT_TRANSITION)
|
SUPPORT_TRANSITION)
|
||||||
|
|
||||||
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||||
|
vol.Required(CONF_HOST): cv.string,
|
||||||
|
})
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
|
||||||
"""Setup Osram Lightify lights."""
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
"""Setup the Osram Lightify lights."""
|
||||||
import lightify
|
import lightify
|
||||||
host = config.get(CONF_HOST)
|
host = config.get(CONF_HOST)
|
||||||
if host:
|
if host:
|
||||||
@ -53,7 +51,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
|||||||
str(err))
|
str(err))
|
||||||
_LOGGER.exception(msg)
|
_LOGGER.exception(msg)
|
||||||
return False
|
return False
|
||||||
setup_bridge(bridge, add_devices_callback)
|
setup_bridge(bridge, add_devices)
|
||||||
else:
|
else:
|
||||||
_LOGGER.error('No host found in configuration')
|
_LOGGER.error('No host found in configuration')
|
||||||
return False
|
return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user