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

@@ -15,7 +15,6 @@ from esphome.const import (
CONF_ON_BLE_SERVICE_DATA_ADVERTISE,
CONF_ON_BLE_MANUFACTURER_DATA_ADVERTISE,
)
from esphome.core import coroutine
ESP_PLATFORMS = [ESP_PLATFORM_ESP32]
AUTO_LOAD = ["xiaomi_ble", "ruuvi_ble"]
@@ -216,15 +215,13 @@ async def to_code(config):
await automation.build_automation(trigger, [(adv_data_t_const_ref, "x")], conf)
@coroutine
def register_ble_device(var, config):
paren = yield cg.get_variable(config[CONF_ESP32_BLE_ID])
async def register_ble_device(var, config):
paren = await cg.get_variable(config[CONF_ESP32_BLE_ID])
cg.add(paren.register_listener(var))
yield var
return var
@coroutine
def register_client(var, config):
paren = yield cg.get_variable(config[CONF_ESP32_BLE_ID])
async def register_client(var, config):
paren = await cg.get_variable(config[CONF_ESP32_BLE_ID])
cg.add(paren.register_client(var))
yield var
return var