mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-01 10:38:27 +02: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:
@@ -56,12 +56,12 @@ async def to_code(config):
|
||||
key=CONF_RTTTL,
|
||||
),
|
||||
)
|
||||
def rtttl_play_to_code(config, action_id, template_arg, args):
|
||||
paren = yield cg.get_variable(config[CONF_ID])
|
||||
async def rtttl_play_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_RTTTL], args, cg.std_string)
|
||||
template_ = await cg.templatable(config[CONF_RTTTL], args, cg.std_string)
|
||||
cg.add(var.set_value(template_))
|
||||
yield var
|
||||
return var
|
||||
|
||||
|
||||
@automation.register_action(
|
||||
@@ -73,10 +73,10 @@ def rtttl_play_to_code(config, action_id, template_arg, args):
|
||||
}
|
||||
),
|
||||
)
|
||||
def rtttl_stop_to_code(config, action_id, template_arg, args):
|
||||
async def rtttl_stop_to_code(config, action_id, template_arg, args):
|
||||
var = cg.new_Pvariable(action_id, template_arg)
|
||||
yield cg.register_parented(var, config[CONF_ID])
|
||||
yield var
|
||||
await cg.register_parented(var, config[CONF_ID])
|
||||
return var
|
||||
|
||||
|
||||
@automation.register_condition(
|
||||
@@ -88,7 +88,7 @@ def rtttl_stop_to_code(config, action_id, template_arg, args):
|
||||
}
|
||||
),
|
||||
)
|
||||
def rtttl_is_playing_to_code(config, condition_id, template_arg, args):
|
||||
async def rtttl_is_playing_to_code(config, condition_id, template_arg, args):
|
||||
var = cg.new_Pvariable(condition_id, template_arg)
|
||||
yield cg.register_parented(var, config[CONF_ID])
|
||||
yield var
|
||||
await cg.register_parented(var, config[CONF_ID])
|
||||
return var
|
||||
|
||||
Reference in New Issue
Block a user