1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-15 07:08:20 +00:00

Fix conditions

This commit is contained in:
Otto Winter 2018-11-30 19:48:44 +01:00
parent a7ee95f999
commit 100640474a
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
2 changed files with 6 additions and 3 deletions

View File

@ -45,7 +45,7 @@ def validate_recursive_condition(value):
u"".format(key, key2)) u"".format(key, key2))
validator = CONDITION_REGISTRY[key][0] validator = CONDITION_REGISTRY[key][0]
value[i] = { value[i] = {
CONF_CONDITION_ID: cv.declare_variable_id(Condition)(item[CONF_ACTION_ID]), CONF_CONDITION_ID: cv.declare_variable_id(Condition)(item[CONF_CONDITION_ID]),
key: validator(item[key]) key: validator(item[key])
} }
return value return value
@ -316,7 +316,7 @@ def build_actions(config, arg_type):
def build_condition(full_config, arg_type): def build_condition(full_config, arg_type):
action_id = full_config[CONF_ACTION_ID] action_id = full_config[CONF_CONDITION_ID]
key, config = next((k, v) for k, v in full_config.items() if k in CONDITION_REGISTRY) key, config = next((k, v) for k, v in full_config.items() if k in CONDITION_REGISTRY)
builder = CONDITION_REGISTRY[key][1] builder = CONDITION_REGISTRY[key][1]

View File

@ -1,5 +1,5 @@
esphomeyaml: esphomeyaml:
name: test2 name: $devicename
platform: ESP32 platform: ESP32
board: nodemcu-32s board: nodemcu-32s
# Use latest upstream esphomelib git version. # Use latest upstream esphomelib git version.
@ -11,6 +11,9 @@ esphomeyaml:
use_custom_code: true use_custom_code: true
build_path: build/test2 build_path: build/test2
substitutions:
devicename: test2
wifi: wifi:
ssid: 'MySSID' ssid: 'MySSID'
password: 'password1' password: 'password1'