Add COMPONENT_SCHEMA and use it in alarm_control_panel (#20224)

* Add COMPONENT_SCHEMA and use in alarm and mqtt

* Revert MQTT changes

* Lint

* Small tweak

* Add tests

* Rename COMPONENT_SCHEMA to PLATFORM_SCHEMA_BASE

* Fix tests

* Improve tests
This commit is contained in:
emontnemery 2019-01-29 01:14:55 +01:00 committed by Paulus Schoutsen
parent bb4ca1f525
commit d7ba2aad1d
5 changed files with 137 additions and 9 deletions

View file

@ -557,6 +557,15 @@ PLATFORM_SCHEMA = vol.Schema({
vol.Optional(CONF_SCAN_INTERVAL): time_period
}, extra=vol.ALLOW_EXTRA)
# This will replace PLATFORM_SCHEMA once all base components are updated
PLATFORM_SCHEMA_2 = vol.Schema({
vol.Required(CONF_PLATFORM): string,
vol.Optional(CONF_SCAN_INTERVAL): time_period
})
PLATFORM_SCHEMA_BASE = PLATFORM_SCHEMA_2.extend({
}, extra=vol.ALLOW_EXTRA)
EVENT_SCHEMA = vol.Schema({
vol.Optional(CONF_ALIAS): string,
vol.Required('event'): string,