1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-19 08:15:49 +00:00

Add logger.log action (#198)

* Add logger.log Action

* Simple schema

* Validate printf

* Improve error message

* Undo unfix tests :)
This commit is contained in:
Otto Winter
2018-10-20 15:19:59 +02:00
committed by GitHub
parent 8c5d12df51
commit 8bbfbc4cc1
4 changed files with 83 additions and 6 deletions

View File

@@ -86,9 +86,12 @@ def validate_automation(extra_schema=None, extra_validators=None, single=False):
try:
# First try as a sequence of actions
return [schema({CONF_THEN: value})]
except vol.Invalid:
except vol.Invalid as err:
# Next try as a sequence of automations
return vol.Schema([schema])(value)
try:
return vol.Schema([schema])(value)
except vol.Invalid as err2:
raise vol.MultipleInvalid([err, err2])
elif isinstance(value, dict):
if CONF_THEN in value:
return [schema(value)]