Fix IHC config schema (#19415)

* Update __init__.py

Update "unit" -> "unit_of_measurement" and configuration (from plural to singular)

* Update __init__.py

* Removing vol.ALLOW_EXTRA arguments

* Update __init__.py
pull/19428/head
Morten Lüneborg 2018-12-18 12:40:03 +01:00 committed by Fabian Affolter
parent 6c64b315db
commit c59e049050
1 changed files with 10 additions and 9 deletions

View File

@ -18,8 +18,8 @@ from homeassistant.components.ihc.const import (
SERVICE_SET_RUNTIME_VALUE_FLOAT, SERVICE_SET_RUNTIME_VALUE_INT)
from homeassistant.config import load_yaml_config_file
from homeassistant.const import (
CONF_BINARY_SENSORS, CONF_ID, CONF_LIGHTS, CONF_NAME, CONF_PASSWORD,
CONF_SENSORS, CONF_SWITCHES, CONF_TYPE, CONF_UNIT_OF_MEASUREMENT, CONF_URL,
CONF_ID, CONF_NAME, CONF_PASSWORD,
CONF_TYPE, CONF_UNIT_OF_MEASUREMENT, CONF_URL,
CONF_USERNAME, TEMP_CELSIUS)
from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv
@ -49,7 +49,7 @@ DEVICE_SCHEMA = vol.Schema({
vol.Optional(CONF_NAME): cv.string,
vol.Optional(CONF_POSITION): cv.string,
vol.Optional(CONF_NOTE): cv.string
}, extra=vol.ALLOW_EXTRA)
})
SWITCH_SCHEMA = DEVICE_SCHEMA.extend({
@ -75,31 +75,31 @@ IHC_SCHEMA = vol.Schema({
vol.Required(CONF_PASSWORD): cv.string,
vol.Optional(CONF_AUTOSETUP, default=True): cv.boolean,
vol.Optional(CONF_INFO, default=True): cv.boolean,
vol.Optional(CONF_BINARY_SENSORS, default=[]):
vol.Optional(CONF_BINARY_SENSOR, default=[]):
vol.All(cv.ensure_list, [
vol.All(
BINARY_SENSOR_SCHEMA,
validate_name)
]),
vol.Optional(CONF_LIGHTS, default=[]):
vol.Optional(CONF_LIGHT, default=[]):
vol.All(cv.ensure_list, [
vol.All(
LIGHT_SCHEMA,
validate_name)
]),
vol.Optional(CONF_SENSORS, default=[]):
vol.Optional(CONF_SENSOR, default=[]):
vol.All(cv.ensure_list, [
vol.All(
SENSOR_SCHEMA,
validate_name)
]),
vol.Optional(CONF_SWITCHES, default=[]):
vol.Optional(CONF_SWITCH, default=[]):
vol.All(cv.ensure_list, [
vol.All(
SWITCH_SCHEMA,
validate_name)
]),
}, extra=vol.ALLOW_EXTRA)
})
CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema(vol.All(
@ -224,7 +224,8 @@ def get_manual_configuration(hass, config, conf, ihc_controller,
'type': sensor_cfg.get(CONF_TYPE),
'inverting': sensor_cfg.get(CONF_INVERTING),
'dimmable': sensor_cfg.get(CONF_DIMMABLE),
'unit': sensor_cfg.get(CONF_UNIT_OF_MEASUREMENT)
'unit_of_measurement': sensor_cfg.get(
CONF_UNIT_OF_MEASUREMENT)
}
}
discovery_info[name] = device