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:
Otto Winter
2021-05-24 21:45:31 +02:00
committed by GitHub
parent 93d9d4b50a
commit a33bb32874
60 changed files with 592 additions and 633 deletions
+7 -7
View File
@@ -63,12 +63,12 @@ async def to_code(config):
}
),
)
def servo_write_to_code(config, action_id, template_arg, args):
paren = yield cg.get_variable(config[CONF_ID])
async def servo_write_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)
template_ = yield cg.templatable(config[CONF_LEVEL], args, float)
template_ = await cg.templatable(config[CONF_LEVEL], args, float)
cg.add(var.set_value(template_))
yield var
return var
@automation.register_action(
@@ -80,6 +80,6 @@ def servo_write_to_code(config, action_id, template_arg, args):
}
),
)
def servo_detach_to_code(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 servo_detach_to_code(config, action_id, template_arg, args):
paren = await cg.get_variable(config[CONF_ID])
return cg.new_Pvariable(action_id, template_arg, paren)