Use same pattern for device defaults in both platforms. (#5682)
parent
987f59e8d8
commit
cabc4dff03
|
@ -13,8 +13,8 @@ from homeassistant.components.light import (
|
|||
from homeassistant.components.rflink import (
|
||||
CONF_ALIASSES, CONF_DEVICE_DEFAULTS, CONF_DEVICES, CONF_FIRE_EVENT,
|
||||
CONF_IGNORE_DEVICES, CONF_NEW_DEVICES_GROUP, CONF_SIGNAL_REPETITIONS,
|
||||
DATA_DEVICE_REGISTER, DATA_ENTITY_LOOKUP, DEFAULT_SIGNAL_REPETITIONS,
|
||||
DOMAIN, EVENT_KEY_COMMAND, EVENT_KEY_ID, SwitchableRflinkDevice, cv, vol)
|
||||
DATA_DEVICE_REGISTER, DATA_ENTITY_LOOKUP, DEVICE_DEFAULTS_SCHEMA, DOMAIN,
|
||||
EVENT_KEY_COMMAND, EVENT_KEY_ID, SwitchableRflinkDevice, cv, vol)
|
||||
from homeassistant.const import CONF_NAME, CONF_PLATFORM, CONF_TYPE
|
||||
|
||||
DEPENDENCIES = ['rflink']
|
||||
|
@ -25,11 +25,6 @@ TYPE_DIMMABLE = 'dimmable'
|
|||
TYPE_SWITCHABLE = 'switchable'
|
||||
TYPE_HYBRID = 'hybrid'
|
||||
|
||||
DEVICE_DEFAULTS_SCHEMA = vol.Schema({
|
||||
vol.Optional(CONF_FIRE_EVENT, default=False): cv.boolean,
|
||||
vol.Optional(CONF_SIGNAL_REPETITIONS,
|
||||
default=DEFAULT_SIGNAL_REPETITIONS): vol.Coerce(int),
|
||||
})
|
||||
PLATFORM_SCHEMA = vol.Schema({
|
||||
vol.Required(CONF_PLATFORM): DOMAIN,
|
||||
vol.Optional(CONF_NEW_DEVICES_GROUP, default=None): cv.string,
|
||||
|
|
|
@ -53,6 +53,12 @@ CONF_WAIT_FOR_ACK = 'wait_for_ack'
|
|||
DEFAULT_SIGNAL_REPETITIONS = 1
|
||||
DEFAULT_RECONNECT_INTERVAL = 10
|
||||
|
||||
DEVICE_DEFAULTS_SCHEMA = vol.Schema({
|
||||
vol.Optional(CONF_FIRE_EVENT, default=False): cv.boolean,
|
||||
vol.Optional(CONF_SIGNAL_REPETITIONS,
|
||||
default=DEFAULT_SIGNAL_REPETITIONS): vol.Coerce(int),
|
||||
})
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema({
|
||||
DOMAIN: vol.Schema({
|
||||
vol.Required(CONF_PORT): vol.Any(cv.port, cv.string),
|
||||
|
|
|
@ -9,7 +9,7 @@ import logging
|
|||
|
||||
from homeassistant.components.rflink import (
|
||||
CONF_ALIASSES, CONF_DEVICE_DEFAULTS, CONF_DEVICES, CONF_FIRE_EVENT,
|
||||
CONF_SIGNAL_REPETITIONS, DATA_ENTITY_LOOKUP, DEFAULT_SIGNAL_REPETITIONS,
|
||||
CONF_SIGNAL_REPETITIONS, DATA_ENTITY_LOOKUP, DEVICE_DEFAULTS_SCHEMA,
|
||||
DOMAIN, EVENT_KEY_COMMAND, SwitchableRflinkDevice, cv, vol)
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.const import CONF_NAME, CONF_PLATFORM
|
||||
|
@ -21,11 +21,8 @@ _LOGGER = logging.getLogger(__name__)
|
|||
|
||||
PLATFORM_SCHEMA = vol.Schema({
|
||||
vol.Required(CONF_PLATFORM): DOMAIN,
|
||||
vol.Optional(CONF_DEVICE_DEFAULTS, default={}): vol.Schema({
|
||||
vol.Optional(CONF_FIRE_EVENT, default=False): cv.boolean,
|
||||
vol.Optional(CONF_SIGNAL_REPETITIONS,
|
||||
default=DEFAULT_SIGNAL_REPETITIONS): vol.Coerce(int),
|
||||
}),
|
||||
vol.Optional(CONF_DEVICE_DEFAULTS, default=DEVICE_DEFAULTS_SCHEMA({})):
|
||||
DEVICE_DEFAULTS_SCHEMA,
|
||||
vol.Optional(CONF_DEVICES, default={}): vol.Schema({
|
||||
cv.string: {
|
||||
vol.Optional(CONF_NAME): cv.string,
|
||||
|
|
Loading…
Reference in New Issue