mirror of
https://github.com/esphome/esphome.git
synced 2025-01-20 04:44:05 +00:00
1c7ca4bc6f
* Recommend similar keys for spelling errors Fixes https://github.com/esphome/feature-requests/issues/68 * Fixes * Fix
27 lines
803 B
Python
27 lines
803 B
Python
import voluptuous as vol
|
|
|
|
from esphome import config_validation as cv, pins
|
|
from esphome.const import CONF_ID, CONF_PIN
|
|
from esphome.cpp_generator import Pvariable
|
|
from esphome.cpp_helpers import gpio_output_pin_expression, setup_component
|
|
from esphome.cpp_types import App, Component, esphome_ns
|
|
|
|
StatusLEDComponent = esphome_ns.class_('StatusLEDComponent', Component)
|
|
|
|
CONFIG_SCHEMA = cv.Schema({
|
|
cv.GenerateID(): cv.declare_variable_id(StatusLEDComponent),
|
|
vol.Optional(CONF_PIN): pins.gpio_output_pin_schema,
|
|
}).extend(cv.COMPONENT_SCHEMA.schema)
|
|
|
|
|
|
def to_code(config):
|
|
for pin in gpio_output_pin_expression(config[CONF_PIN]):
|
|
yield
|
|
rhs = App.make_status_led(pin)
|
|
var = Pvariable(config[CONF_ID], rhs)
|
|
|
|
setup_component(var, config)
|
|
|
|
|
|
BUILD_FLAGS = '-DUSE_STATUS_LED'
|