1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-16 14:55:50 +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

@@ -29,12 +29,12 @@ CONFIG_SCHEMA = cv.All(
)
def to_code(config):
hub = yield cg.get_variable(config[CONF_DALLAS_ID])
async def to_code(config):
hub = await cg.get_variable(config[CONF_DALLAS_ID])
if CONF_ADDRESS in config:
address = config[CONF_ADDRESS]
rhs = hub.Pget_sensor_by_address(address, config.get(CONF_RESOLUTION))
else:
rhs = hub.Pget_sensor_by_index(config[CONF_INDEX], config.get(CONF_RESOLUTION))
var = cg.Pvariable(config[CONF_ID], rhs)
yield sensor.register_sensor(var, config)
await sensor.register_sensor(var, config)