1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-06 11:53:45 +01:00

Convert components to async-def syntax (#1821)

This commit is contained in:
Otto Winter
2021-05-24 10:58:29 +02:00
committed by GitHub
parent b92702a312
commit 2376a2c941
296 changed files with 1423 additions and 1424 deletions

View File

@@ -61,7 +61,7 @@ CONFIG_SCHEMA = automation.validate_automation(
)
def to_code(config):
async def to_code(config):
# Register all variables first, so that scripts can use other scripts
triggers = []
for conf in config:
@@ -73,12 +73,12 @@ def to_code(config):
cg.add(trigger.set_max_runs(conf[CONF_MAX_RUNS]))
if conf[CONF_MODE] == CONF_QUEUED:
yield cg.register_component(trigger, conf)
await cg.register_component(trigger, conf)
triggers.append((trigger, conf))
for trigger, conf in triggers:
yield automation.build_automation(trigger, [], conf)
await automation.build_automation(trigger, [], conf)
@automation.register_action(