Fix Switch Condition

Fixes https://github.com/esphome/issues/issues/322
This commit is contained in:
Otto Winter 2019-05-26 10:31:12 +02:00
parent 9ed06444e1
commit d8963ea25a
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E

View File

@ -83,13 +83,13 @@ def switch_toggle_to_code(config, action_id, template_arg, args):
@automation.register_condition('switch.is_on', SwitchCondition, SWITCH_ACTION_SCHEMA)
def switch_is_on_to_code(config, condition_id, template_arg, args):
paren = yield cg.get_variable(config[CONF_ID])
yield cg.new_Pvariable(condition_id, template_arg, paren)
yield cg.new_Pvariable(condition_id, template_arg, paren, True)
@automation.register_condition('switch.is_off', SwitchCondition, SWITCH_ACTION_SCHEMA)
def switch_is_off_to_code(config, condition_id, template_arg, args):
paren = yield cg.get_variable(config[CONF_ID])
yield cg.new_Pvariable(condition_id, template_arg, paren)
yield cg.new_Pvariable(condition_id, template_arg, paren, False)
@coroutine_with_priority(100.0)