Compare commits

..

3 Commits

Author SHA1 Message Date
Pascal Vizeli
2d7208470e Merge pull request #28354 from home-assistant/rc
0.101.0
2019-10-30 21:20:32 +01:00
Pascal Vizeli
7eceedea10 Bump version 0.101.0 2019-10-30 19:50:48 +00:00
springstan
8aee92347f Fix KeyError in decora setup (#28279)
* Imported homeassistant.util and slugified address if no name is specified

* Added a custom validator function in case name is not set in config

* Removed logger.debug line only used for testing
2019-10-30 19:47:14 +00:00
2 changed files with 21 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
"""Support for Decora dimmers."""
import copy
from functools import wraps
import logging
import time
@@ -15,17 +16,34 @@ from homeassistant.components.light import (
)
from homeassistant.const import CONF_API_KEY, CONF_DEVICES, CONF_NAME
import homeassistant.helpers.config_validation as cv
import homeassistant.util as util
_LOGGER = logging.getLogger(__name__)
SUPPORT_DECORA_LED = SUPPORT_BRIGHTNESS
def _name_validator(config):
"""Validate the name."""
config = copy.deepcopy(config)
for address, device_config in config[CONF_DEVICES].items():
if CONF_NAME not in device_config:
device_config[CONF_NAME] = util.slugify(address)
return config
DEVICE_SCHEMA = vol.Schema(
{vol.Optional(CONF_NAME): cv.string, vol.Required(CONF_API_KEY): cv.string}
)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{vol.Optional(CONF_DEVICES, default={}): {cv.string: DEVICE_SCHEMA}}
PLATFORM_SCHEMA = vol.Schema(
vol.All(
PLATFORM_SCHEMA.extend(
{vol.Optional(CONF_DEVICES, default={}): {cv.string: DEVICE_SCHEMA}}
),
_name_validator,
)
)

View File

@@ -1,7 +1,7 @@
"""Constants used by Home Assistant components."""
MAJOR_VERSION = 0
MINOR_VERSION = 101
PATCH_VERSION = "0b4"
PATCH_VERSION = "0"
__short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION)
__version__ = "{}.{}".format(__short_version__, PATCH_VERSION)
REQUIRED_PYTHON_VER = (3, 6, 1)