1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-20 00:35:44 +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

@@ -39,12 +39,12 @@ CONFIG_SCHEMA = cv.All(
)
def to_code(config):
async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
yield cg.register_component(var, config)
yield climate.register_climate(var, config)
await cg.register_component(var, config)
await climate.register_climate(var, config)
sens = yield cg.get_variable(config[CONF_SENSOR])
sens = await cg.get_variable(config[CONF_SENSOR])
cg.add(var.set_sensor(sens))
normal_config = BangBangClimateTargetTempConfig(
@@ -53,17 +53,17 @@ def to_code(config):
)
cg.add(var.set_normal_config(normal_config))
yield automation.build_automation(
await automation.build_automation(
var.get_idle_trigger(), [], config[CONF_IDLE_ACTION]
)
if CONF_COOL_ACTION in config:
yield automation.build_automation(
await automation.build_automation(
var.get_cool_trigger(), [], config[CONF_COOL_ACTION]
)
cg.add(var.set_supports_cool(True))
if CONF_HEAT_ACTION in config:
yield automation.build_automation(
await automation.build_automation(
var.get_heat_trigger(), [], config[CONF_HEAT_ACTION]
)
cg.add(var.set_supports_heat(True))