Add area support to Wink service schemas (#25445)

pull/25450/head
Aaron Bach 2019-07-23 14:04:59 -06:00 committed by GitHub
parent c92f287c73
commit bd2b107575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 22 deletions

View File

@ -9,12 +9,13 @@ import voluptuous as vol
from homeassistant.components.http import HomeAssistantView
from homeassistant.const import (
ATTR_BATTERY_LEVEL, ATTR_ENTITY_ID, ATTR_NAME, CONF_EMAIL, CONF_PASSWORD,
ATTR_BATTERY_LEVEL, ATTR_NAME, CONF_EMAIL, CONF_PASSWORD,
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, STATE_OFF, STATE_ON,
__version__)
from homeassistant.core import callback
from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.config_validation import ENTITY_SERVICE_SCHEMA
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.event import track_time_interval
@ -106,14 +107,11 @@ CONFIG_SCHEMA = vol.Schema({
})
}, extra=vol.ALLOW_EXTRA)
RENAME_DEVICE_SCHEMA = vol.Schema({
vol.Required(ATTR_ENTITY_ID): cv.entity_ids,
RENAME_DEVICE_SCHEMA = ENTITY_SERVICE_SCHEMA.extend({
vol.Required(ATTR_NAME): cv.string,
}, extra=vol.ALLOW_EXTRA)
DELETE_DEVICE_SCHEMA = vol.Schema({
vol.Required(ATTR_ENTITY_ID): cv.entity_ids,
}, extra=vol.ALLOW_EXTRA)
DELETE_DEVICE_SCHEMA = ENTITY_SERVICE_SCHEMA.extend({}, extra=vol.ALLOW_EXTRA)
SET_PAIRING_MODE_SCHEMA = vol.Schema({
vol.Required(ATTR_HUB_NAME): cv.string,
@ -121,38 +119,31 @@ SET_PAIRING_MODE_SCHEMA = vol.Schema({
vol.Optional(ATTR_KIDDE_RADIO_CODE): cv.string,
}, extra=vol.ALLOW_EXTRA)
SET_VOLUME_SCHEMA = vol.Schema({
vol.Optional(ATTR_ENTITY_ID): cv.entity_ids,
SET_VOLUME_SCHEMA = ENTITY_SERVICE_SCHEMA.extend({
vol.Required(ATTR_VOLUME): vol.In(VOLUMES),
})
SET_SIREN_TONE_SCHEMA = vol.Schema({
vol.Optional(ATTR_ENTITY_ID): cv.entity_ids,
SET_SIREN_TONE_SCHEMA = ENTITY_SERVICE_SCHEMA.extend({
vol.Required(ATTR_TONE): vol.In(TONES),
})
SET_CHIME_MODE_SCHEMA = vol.Schema({
vol.Optional(ATTR_ENTITY_ID): cv.entity_ids,
SET_CHIME_MODE_SCHEMA = ENTITY_SERVICE_SCHEMA.extend({
vol.Required(ATTR_TONE): vol.In(CHIME_TONES),
})
SET_AUTO_SHUTOFF_SCHEMA = vol.Schema({
vol.Optional(ATTR_ENTITY_ID): cv.entity_ids,
SET_AUTO_SHUTOFF_SCHEMA = ENTITY_SERVICE_SCHEMA.extend({
vol.Required(ATTR_AUTO_SHUTOFF): vol.In(AUTO_SHUTOFF_TIMES),
})
SET_STROBE_ENABLED_SCHEMA = vol.Schema({
vol.Optional(ATTR_ENTITY_ID): cv.entity_ids,
SET_STROBE_ENABLED_SCHEMA = ENTITY_SERVICE_SCHEMA.extend({
vol.Required(ATTR_ENABLED): cv.boolean,
})
ENABLED_SIREN_SCHEMA = vol.Schema({
vol.Optional(ATTR_ENTITY_ID): cv.entity_ids,
ENABLED_SIREN_SCHEMA = ENTITY_SERVICE_SCHEMA.extend({
vol.Required(ATTR_ENABLED): cv.boolean
})
DIAL_CONFIG_SCHEMA = vol.Schema({
vol.Required(ATTR_ENTITY_ID): cv.entity_ids,
DIAL_CONFIG_SCHEMA = ENTITY_SERVICE_SCHEMA.extend({
vol.Optional(ATTR_MIN_VALUE): vol.Coerce(int),
vol.Optional(ATTR_MAX_VALUE): vol.Coerce(int),
vol.Optional(ATTR_MIN_POSITION): cv.positive_int,
@ -162,8 +153,7 @@ DIAL_CONFIG_SCHEMA = vol.Schema({
vol.Optional(ATTR_TICKS): cv.positive_int,
})
DIAL_STATE_SCHEMA = vol.Schema({
vol.Required(ATTR_ENTITY_ID): cv.entity_ids,
DIAL_STATE_SCHEMA = ENTITY_SERVICE_SCHEMA.extend({
vol.Required(ATTR_VALUE): vol.Coerce(int),
vol.Optional(ATTR_LABELS): cv.ensure_list(cv.string),
})