Use PLATFORM_SCHEMA_BASE as base schema for additional components. (#20578)
* Disable extra=vol.ALLOW_EXTRA for additional platforms. * Remove PLATFORM_SCHEMA_2 * Add entity_namespace to base platform schema
This commit is contained in:
parent
154b401d0a
commit
b1faad0a50
32 changed files with 75 additions and 81 deletions
|
@ -11,7 +11,8 @@ import logging
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.config_validation import PLATFORM_SCHEMA # noqa
|
||||
from homeassistant.helpers.config_validation import ( # noqa
|
||||
PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE)
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_BATTERY, DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE,
|
||||
DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_TIMESTAMP, DEVICE_CLASS_PRESSURE)
|
||||
|
|
|
@ -38,12 +38,11 @@ DEFAULT_TOPIC = 'room_presence'
|
|||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Required(CONF_DEVICE_ID): cv.string,
|
||||
vol.Required(CONF_STATE_TOPIC, default=DEFAULT_TOPIC): cv.string,
|
||||
vol.Required(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): cv.positive_int,
|
||||
vol.Optional(CONF_AWAY_TIMEOUT,
|
||||
default=DEFAULT_AWAY_TIMEOUT): cv.positive_int,
|
||||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string
|
||||
})
|
||||
}).extend(mqtt.MQTT_RO_PLATFORM_SCHEMA.schema)
|
||||
|
||||
MQTT_PAYLOAD = vol.Schema(vol.All(json.loads, vol.Schema({
|
||||
vol.Required(ATTR_ID): cv.string,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue