mirror of
https://github.com/esphome/esphome.git
synced 2025-09-25 14:42:21 +01:00
Convert automation engine to use variadic templates (#452)
This commit is contained in:
@@ -92,13 +92,13 @@ STEPPER_SET_TARGET_ACTION_SCHEMA = cv.Schema({
|
||||
|
||||
|
||||
@ACTION_REGISTRY.register(CONF_STEPPER_SET_TARGET, STEPPER_SET_TARGET_ACTION_SCHEMA)
|
||||
def stepper_set_target_to_code(config, action_id, arg_type, template_arg):
|
||||
def stepper_set_target_to_code(config, action_id, template_arg, args):
|
||||
for var in get_variable(config[CONF_ID]):
|
||||
yield None
|
||||
rhs = var.make_set_target_action(template_arg)
|
||||
type = SetTargetAction.template(arg_type)
|
||||
type = SetTargetAction.template(template_arg)
|
||||
action = Pvariable(action_id, rhs, type=type)
|
||||
for template_ in templatable(config[CONF_TARGET], arg_type, int32):
|
||||
for template_ in templatable(config[CONF_TARGET], args, int32):
|
||||
yield None
|
||||
add(action.set_target(template_))
|
||||
yield action
|
||||
@@ -112,13 +112,13 @@ STEPPER_REPORT_POSITION_ACTION_SCHEMA = cv.Schema({
|
||||
|
||||
|
||||
@ACTION_REGISTRY.register(CONF_STEPPER_REPORT_POSITION, STEPPER_REPORT_POSITION_ACTION_SCHEMA)
|
||||
def stepper_report_position_to_code(config, action_id, arg_type, template_arg):
|
||||
def stepper_report_position_to_code(config, action_id, template_arg, args):
|
||||
for var in get_variable(config[CONF_ID]):
|
||||
yield None
|
||||
rhs = var.make_report_position_action(template_arg)
|
||||
type = ReportPositionAction.template(arg_type)
|
||||
type = ReportPositionAction.template(template_arg)
|
||||
action = Pvariable(action_id, rhs, type=type)
|
||||
for template_ in templatable(config[CONF_POSITION], arg_type, int32):
|
||||
for template_ in templatable(config[CONF_POSITION], args, int32):
|
||||
yield None
|
||||
add(action.set_position(template_))
|
||||
yield action
|
||||
|
Reference in New Issue
Block a user