mirror of
https://github.com/esphome/esphome.git
synced 2025-02-21 20:38:16 +00:00
* Cleanup dashboard JS * Add vscode * Save start_mark/end_mark * Updates * Updates * Remove need for cv.nameable It's a bit hacky but removes so much bloat from integrations * Add enum helper * Document APIs, and Improvements * Fixes * Fixes * Update PULL_REQUEST_TEMPLATE.md * Updates * Updates * Updates
21 lines
660 B
Python
21 lines
660 B
Python
import esphome.codegen as cg
|
|
import esphome.config_validation as cv
|
|
from esphome.components import light, output
|
|
from esphome.const import CONF_OUTPUT_ID, CONF_OUTPUT
|
|
from .. import binary_ns
|
|
|
|
BinaryLightOutput = binary_ns.class_('BinaryLightOutput', light.LightOutput)
|
|
|
|
CONFIG_SCHEMA = light.BINARY_LIGHT_SCHEMA.extend({
|
|
cv.GenerateID(CONF_OUTPUT_ID): cv.declare_id(BinaryLightOutput),
|
|
cv.Required(CONF_OUTPUT): cv.use_id(output.BinaryOutput),
|
|
})
|
|
|
|
|
|
def to_code(config):
|
|
var = cg.new_Pvariable(config[CONF_OUTPUT_ID])
|
|
yield light.register_light(var, config)
|
|
|
|
out = yield cg.get_variable(config[CONF_OUTPUT])
|
|
cg.add(var.set_output(out))
|