1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-03 18:42:23 +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

@@ -38,18 +38,18 @@ CONFIG_SCHEMA = stepper.STEPPER_SCHEMA.extend(
).extend(cv.COMPONENT_SCHEMA)
def to_code(config):
async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
yield cg.register_component(var, config)
yield stepper.register_stepper(var, config)
await cg.register_component(var, config)
await stepper.register_stepper(var, config)
pin_a = yield cg.gpio_pin_expression(config[CONF_PIN_A])
pin_a = await cg.gpio_pin_expression(config[CONF_PIN_A])
cg.add(var.set_pin_a(pin_a))
pin_b = yield cg.gpio_pin_expression(config[CONF_PIN_B])
pin_b = await cg.gpio_pin_expression(config[CONF_PIN_B])
cg.add(var.set_pin_b(pin_b))
pin_c = yield cg.gpio_pin_expression(config[CONF_PIN_C])
pin_c = await cg.gpio_pin_expression(config[CONF_PIN_C])
cg.add(var.set_pin_c(pin_c))
pin_d = yield cg.gpio_pin_expression(config[CONF_PIN_D])
pin_d = await cg.gpio_pin_expression(config[CONF_PIN_D])
cg.add(var.set_pin_d(pin_d))
cg.add(var.set_sleep_when_done(config[CONF_SLEEP_WHEN_DONE]))