1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 06:33:51 +00: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

@@ -47,16 +47,16 @@ CONFIG_SCHEMA = remote_base.validate_triggers(
)
def to_code(config):
pin = yield cg.gpio_pin_expression(config[CONF_PIN])
async def to_code(config):
pin = await cg.gpio_pin_expression(config[CONF_PIN])
if CORE.is_esp32:
var = cg.new_Pvariable(config[CONF_ID], pin, config[CONF_MEMORY_BLOCKS])
else:
var = cg.new_Pvariable(config[CONF_ID], pin)
yield remote_base.build_dumpers(config[CONF_DUMP])
yield remote_base.build_triggers(config)
yield cg.register_component(var, config)
await remote_base.build_dumpers(config[CONF_DUMP])
await remote_base.build_triggers(config)
await cg.register_component(var, config)
cg.add(var.set_tolerance(config[CONF_TOLERANCE]))
cg.add(var.set_buffer_size(config[CONF_BUFFER_SIZE]))

View File

@@ -7,7 +7,7 @@ DEPENDENCIES = ["remote_receiver"]
CONFIG_SCHEMA = remote_base.validate_binary_sensor
def to_code(config):
var = yield remote_base.build_binary_sensor(config)
async def to_code(config):
var = await remote_base.build_binary_sensor(config)
cg.add(var.set_name(config[CONF_NAME]))
yield binary_sensor.register_binary_sensor(var, config)
await binary_sensor.register_binary_sensor(var, config)