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
+3 -5
View File
@@ -8,7 +8,6 @@ from esphome.const import (
CONF_SSID,
CONF_MAC_ADDRESS,
)
from esphome.core import coroutine
DEPENDENCIES = ["wifi"]
@@ -50,13 +49,12 @@ CONFIG_SCHEMA = cv.Schema(
)
@coroutine
def setup_conf(config, key):
async def setup_conf(config, key):
if key in config:
conf = config[key]
var = cg.new_Pvariable(conf[CONF_ID])
yield cg.register_component(var, conf)
yield text_sensor.register_text_sensor(var, conf)
await cg.register_component(var, conf)
await text_sensor.register_text_sensor(var, conf)
async def to_code(config):