1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-25 06:32:22 +01:00
This commit is contained in:
Otto Winter
2018-06-01 18:06:18 +02:00
parent 2d4b475951
commit 5b995c0692
11 changed files with 41 additions and 21 deletions

View File

@@ -19,10 +19,12 @@ MakeTemplateSwitch = Application.MakeTemplateSwitch
def to_code(config):
template_ = process_lambda(config.get(CONF_LAMBDA), [])
rhs = App.make_template_switch(config[CONF_NAME], template_)
rhs = App.make_template_switch(config[CONF_NAME])
make = variable(MakeTemplateSwitch, config[CONF_MAKE_ID], rhs)
if CONF_LAMBDA in config:
template_ = process_lambda(config[CONF_LAMBDA], [])
add(make.Ptemplate.set_state_lambda(template_))
if CONF_TURN_OFF_ACTION in config:
actions = automation.build_actions(config[CONF_TURN_OFF_ACTION], NoArg)
add(make.Ptemplate_.add_turn_off_actions(actions))