mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-30 01:38:27 +02:00
Convert components to async-def syntax (#1821)
This commit is contained in:
@@ -45,21 +45,21 @@ CONFIG_SCHEMA = cv.Schema(
|
||||
).extend(cv.polling_component_schema("60s"))
|
||||
|
||||
|
||||
def to_code(config):
|
||||
async def to_code(config):
|
||||
var = cg.new_Pvariable(config[CONF_ID])
|
||||
yield cg.register_component(var, config)
|
||||
await cg.register_component(var, config)
|
||||
|
||||
pin_clock = yield gpio_pin_expression(config[CONF_CLOCK_PIN])
|
||||
pin_clock = await gpio_pin_expression(config[CONF_CLOCK_PIN])
|
||||
cg.add(var.set_pin_clock(pin_clock))
|
||||
pin_data = yield gpio_pin_expression(config[CONF_DATA_PIN])
|
||||
pin_data = await gpio_pin_expression(config[CONF_DATA_PIN])
|
||||
cg.add(var.set_pin_data(pin_data))
|
||||
|
||||
if CONF_CO2 in config:
|
||||
sens = yield sensor.new_sensor(config[CONF_CO2])
|
||||
sens = await sensor.new_sensor(config[CONF_CO2])
|
||||
cg.add(var.set_co2_sensor(sens))
|
||||
if CONF_TEMPERATURE in config:
|
||||
sens = yield sensor.new_sensor(config[CONF_TEMPERATURE])
|
||||
sens = await sensor.new_sensor(config[CONF_TEMPERATURE])
|
||||
cg.add(var.set_temperature_sensor(sens))
|
||||
if CONF_HUMIDITY in config:
|
||||
sens = yield sensor.new_sensor(config[CONF_HUMIDITY])
|
||||
sens = await sensor.new_sensor(config[CONF_HUMIDITY])
|
||||
cg.add(var.set_humidity_sensor(sens))
|
||||
|
||||
Reference in New Issue
Block a user