Introduce new async-def coroutine syntax (#1657)

This commit is contained in:
Otto Winter
2021-05-17 07:14:15 +02:00
committed by GitHub
parent 95ed3e9d46
commit d4686c0fb1
10 changed files with 391 additions and 238 deletions
+2 -2
View File
@@ -32,12 +32,12 @@ CONFIG_SCHEMA = cv.Schema(
@coroutine_with_priority(50.0)
def to_code(config):
async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
cg.add(var.set_port(config[CONF_PORT]))
cg.add(var.set_auth_password(config[CONF_PASSWORD]))
yield cg.register_component(var, config)
await cg.register_component(var, config)
if config[CONF_SAFE_MODE]:
condition = var.should_enter_safe_mode(