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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user