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
+3 -3
View File
@@ -48,10 +48,10 @@ CONFIG_SCHEMA = cv.Schema(
).extend(i2c.i2c_device_schema(0x76))
def to_code(config):
async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
yield cg.register_component(var, config)
yield i2c.register_i2c_device(var, config)
await cg.register_component(var, config)
await i2c.register_i2c_device(var, config)
cg.add(var.set_temperature_offset(config[CONF_TEMPERATURE_OFFSET]))
cg.add(var.set_iaq_mode(config[CONF_IAQ_MODE]))
+3 -3
View File
@@ -97,7 +97,7 @@ def setup_conf(config, key, hub):
cg.add(getattr(hub, f"set_{key}_sample_rate")(conf[CONF_SAMPLE_RATE]))
def to_code(config):
hub = yield cg.get_variable(config[CONF_BME680_BSEC_ID])
async def to_code(config):
hub = await cg.get_variable(config[CONF_BME680_BSEC_ID])
for key in TYPES:
yield setup_conf(config, key, hub)
await setup_conf(config, key, hub)
@@ -34,7 +34,7 @@ def setup_conf(config, key, hub):
cg.add(getattr(hub, f"set_{key}_text_sensor")(sens))
def to_code(config):
hub = yield cg.get_variable(config[CONF_BME680_BSEC_ID])
async def to_code(config):
hub = await cg.get_variable(config[CONF_BME680_BSEC_ID])
for key in TYPES:
yield setup_conf(config, key, hub)
await setup_conf(config, key, hub)