Fix automation validation

This commit is contained in:
Otto Winter 2018-10-27 14:10:37 +02:00
parent 2fab7e73b9
commit 0ade9baf65
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E

View File

@ -1,3 +1,5 @@
import copy
import voluptuous as vol import voluptuous as vol
from esphomeyaml import core from esphomeyaml import core
@ -28,8 +30,9 @@ def validate_recursive_condition(value):
def validate_recursive_action(value): def validate_recursive_action(value):
value = cv.ensure_list(value) value = cv.ensure_list(value)[:]
for i, item in enumerate(value): for i, item in enumerate(value):
item = copy.deepcopy(item)
if not isinstance(item, dict): if not isinstance(item, dict):
raise vol.Invalid(u"Action must consist of key-value mapping! Got {}".format(item)) raise vol.Invalid(u"Action must consist of key-value mapping! Got {}".format(item))
key = next((x for x in item if x != CONF_ACTION_ID), None) key = next((x for x in item if x != CONF_ACTION_ID), None)