1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-16 06:45:48 +00:00

Convert components to async-def syntax (#1823)

* Convert components to async-def syntax

* Remove stray @coroutine

* Manual part

* Convert complexer components code to async-def

* Manual cleanup

* More manual cleanup
This commit is contained in:
Otto Winter
2021-05-24 21:45:31 +02:00
committed by GitHub
parent 93d9d4b50a
commit a33bb32874
60 changed files with 592 additions and 633 deletions

View File

@@ -21,7 +21,6 @@ from esphome.const import (
ICON_THERMOMETER,
ICON_WATER_PERCENT,
)
from esphome.core import coroutine
from . import (
BME680BSECComponent,
CONF_BME680_BSEC_ID,
@@ -87,11 +86,10 @@ CONFIG_SCHEMA = cv.Schema(
)
@coroutine
def setup_conf(config, key, hub):
async def setup_conf(config, key, hub):
if key in config:
conf = config[key]
sens = yield sensor.new_sensor(conf)
sens = await sensor.new_sensor(conf)
cg.add(getattr(hub, f"set_{key}_sensor")(sens))
if CONF_SAMPLE_RATE in conf:
cg.add(getattr(hub, f"set_{key}_sample_rate")(conf[CONF_SAMPLE_RATE]))