mirror of
https://github.com/esphome/esphome.git
synced 2025-09-27 23:52:28 +01:00
Convert components to async-def syntax (#1823)
* Convert components to async-def syntax * Remove stray @coroutine * Manual part * Convert complexer components code to async-def * Manual cleanup * More manual cleanup
This commit is contained in:
@@ -86,9 +86,9 @@ async def to_code(config):
|
||||
}
|
||||
),
|
||||
)
|
||||
def pid_reset_integral_term(config, action_id, template_arg, args):
|
||||
paren = yield cg.get_variable(config[CONF_ID])
|
||||
yield cg.new_Pvariable(action_id, template_arg, paren)
|
||||
async def pid_reset_integral_term(config, action_id, template_arg, args):
|
||||
paren = await cg.get_variable(config[CONF_ID])
|
||||
return cg.new_Pvariable(action_id, template_arg, paren)
|
||||
|
||||
|
||||
@automation.register_action(
|
||||
@@ -107,13 +107,13 @@ def pid_reset_integral_term(config, action_id, template_arg, args):
|
||||
}
|
||||
),
|
||||
)
|
||||
def esp8266_set_frequency_to_code(config, action_id, template_arg, args):
|
||||
paren = yield cg.get_variable(config[CONF_ID])
|
||||
async def esp8266_set_frequency_to_code(config, action_id, template_arg, args):
|
||||
paren = await cg.get_variable(config[CONF_ID])
|
||||
var = cg.new_Pvariable(action_id, template_arg, paren)
|
||||
cg.add(var.set_noiseband(config[CONF_NOISEBAND]))
|
||||
cg.add(var.set_positive_output(config[CONF_POSITIVE_OUTPUT]))
|
||||
cg.add(var.set_negative_output(config[CONF_NEGATIVE_OUTPUT]))
|
||||
yield var
|
||||
return var
|
||||
|
||||
|
||||
@automation.register_action(
|
||||
@@ -128,16 +128,16 @@ def esp8266_set_frequency_to_code(config, action_id, template_arg, args):
|
||||
}
|
||||
),
|
||||
)
|
||||
def set_control_parameters(config, action_id, template_arg, args):
|
||||
paren = yield cg.get_variable(config[CONF_ID])
|
||||
async def set_control_parameters(config, action_id, template_arg, args):
|
||||
paren = await cg.get_variable(config[CONF_ID])
|
||||
var = cg.new_Pvariable(action_id, template_arg, paren)
|
||||
|
||||
kp_template_ = yield cg.templatable(config[CONF_KP], args, float)
|
||||
kp_template_ = await cg.templatable(config[CONF_KP], args, float)
|
||||
cg.add(var.set_kp(kp_template_))
|
||||
|
||||
ki_template_ = yield cg.templatable(config[CONF_KI], args, float)
|
||||
ki_template_ = await cg.templatable(config[CONF_KI], args, float)
|
||||
cg.add(var.set_ki(ki_template_))
|
||||
|
||||
kd_template_ = yield cg.templatable(config[CONF_KD], args, float)
|
||||
kd_template_ = await cg.templatable(config[CONF_KD], args, float)
|
||||
cg.add(var.set_kd(kd_template_))
|
||||
yield var
|
||||
return var
|
||||
|
Reference in New Issue
Block a user