Convert components to async-def syntax (#1821)

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

No files matched your search

@@ -17,13 +17,13 @@ CONFIG_SCHEMA = binary_sensor.BINARY_SENSOR_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 binary_sensor.register_binary_sensor(var, config)
await cg.register_component(var, config)
await binary_sensor.register_binary_sensor(var, config)
if CONF_LAMBDA in config:
template_ = yield cg.process_lambda(
template_ = await cg.process_lambda(
config[CONF_LAMBDA], [], return_type=cg.optional.template(bool)
)
cg.add(var.set_template(template_))