1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add automation config validation

* Add automation config validation

* Remove unnecessary dict validator

* Downgrade voluptuous to 0.8.9

* Fix linting

* Address issues
This commit is contained in:
Paulus Schoutsen
2016-04-04 12:18:58 -07:00
parent cbe9a7d2a3
commit 8ef542927f
24 changed files with 570 additions and 443 deletions

View File

@@ -77,9 +77,9 @@ _DELAY_SCHEMA = {
'minutes': vol.All(vol.Coerce(int), vol.Range(min=0)),
'hours': vol.All(vol.Coerce(int), vol.Range(min=0)),
'weeks': vol.All(vol.Coerce(int), vol.Range(min=0)),
}, cv.has_at_least_one_key([
}, cv.has_at_least_one_key(
'days', 'seconds', 'microseconds', 'milliseconds', 'minutes', 'hours',
'weeks']))
'weeks'))
}
_EVENT_SCHEMA = cv.EVENT_SCHEMA.extend({
@@ -97,7 +97,7 @@ _SCRIPT_ENTRY_SCHEMA = vol.Schema({
})
CONFIG_SCHEMA = vol.Schema({
vol.Required(DOMAIN): cv.DictValidator(_SCRIPT_ENTRY_SCHEMA, cv.slug)
vol.Required(DOMAIN): {cv.slug: _SCRIPT_ENTRY_SCHEMA}
}, extra=vol.ALLOW_EXTRA)