New coroutine-based task execution

This commit is contained in:
Otto Winter
2018-06-02 22:22:20 +02:00
parent 2db45898e2
commit 6e85a741ae
76 changed files with 1145 additions and 678 deletions
+10 -6
View File
@@ -8,22 +8,26 @@ from esphomeyaml.helpers import Pvariable, get_variable
DEPENDENCIES = ['pca9685']
Channel = PCA9685OutputComponent.Channel
PLATFORM_SCHEMA = output.PLATFORM_SCHEMA.extend({
vol.Required(CONF_ID): cv.declare_variable_id(Channel),
vol.Required(CONF_CHANNEL): vol.All(vol.Coerce(int),
vol.Range(min=0, max=15)),
vol.Optional(CONF_PCA9685_ID): cv.variable_id,
cv.GenerateID(CONF_PCA9685_ID): cv.use_variable_id(PCA9685OutputComponent),
}).extend(output.FLOAT_OUTPUT_SCHEMA.schema)
Channel = PCA9685OutputComponent.Channel
def to_code(config):
power_supply = None
if CONF_POWER_SUPPLY in config:
power_supply = get_variable(config[CONF_POWER_SUPPLY])
pca9685 = get_variable(config.get(CONF_PCA9685_ID), PCA9685OutputComponent)
for power_supply in get_variable(config[CONF_POWER_SUPPLY]):
yield
pca9685 = None
for pca9685 in get_variable(config[CONF_PCA9685_ID]):
yield
rhs = pca9685.create_channel(config[CONF_CHANNEL], power_supply)
out = Pvariable(Channel, config[CONF_ID], rhs)
out = Pvariable(config[CONF_ID], rhs)
output.setup_output_platform(out, config, skip_power_supply=True)