Closed ProASV closed 5 years ago
What version of esphome are you using? This passes config validation for me, although it's not valid as the lambda needs to return an instance of your custom component, not a value.
output:
- platform: custom
type: float
lambda: |-
return nullptr;
outputs:
id: custom_float
Release version (pip2 install -U esphomeyaml) of esphome. The actual content of this lambda is not so important in this case. My real code was:
output:
- platform: custom
type: 'float'
lambda: |-
auto my_custom_float_output = new NooliteFloatOutput(4);
App.register_component(my_custom_float_output);
return {my_custom_float_output};
outputs:
id: custom_float_bedroom_bra_left
I would try dev. You'll have to update your YAML and command line, but I suspect it'll work there.
I see you have changed the implementation in dev version: Was (esphomeyaml/components/output/custom.py ):
cv.GenerateID(): cv.declare_variable_id(CustomBinaryOutputConstructor),
vol.Required(CONF_LAMBDA): cv.lambda_,
vol.Required(CONF_OUTPUTS):
cv.ensure_list(output.BINARY_OUTPUT_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(output.BinaryOutput),
})),
})
FLOAT_SCHEMA = output.PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(CustomFloatOutputConstructor),
vol.Required(CONF_LAMBDA): cv.lambda_,
vol.Required(CONF_OUTPUTS):
cv.ensure_list(output.FLOAT_OUTPUT_PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(output.FloatOutput),
})),
})
Now ():
BINARY_SCHEMA = output.PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(CustomBinaryOutputConstructor),
vol.Required(CONF_LAMBDA): cv.lambda_,
vol.Required(CONF_TYPE): 'binary',
vol.Required(CONF_OUTPUTS):
cv.ensure_list(output.BINARY_OUTPUT_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(output.BinaryOutput),
})),
})
FLOAT_SCHEMA = output.PLATFORM_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(CustomFloatOutputConstructor),
vol.Required(CONF_LAMBDA): cv.lambda_,
vol.Required(CONF_TYPE): 'float',
vol.Required(CONF_OUTPUTS):
cv.ensure_list(output.FLOAT_OUTPUT_SCHEMA.extend({
cv.GenerateID(): cv.declare_variable_id(output.FloatOutput),
})),
})
So, we can close this issue.
Python 2.7.15 Windows 10
Example one: esp32_test.yaml :
Compiling:
Example two:
Compiling: