mirror of
https://github.com/esphome/esphome.git
synced 2025-09-06 13:22:19 +01:00
Fix Custom Components No Name (#395)
* Fix Custom Components No Name Fixes https://github.com/esphome/ESPHome-Core/issues/445 * Fix
This commit is contained in:
@@ -2,8 +2,8 @@ import voluptuous as vol
|
||||
|
||||
from esphomeyaml.components import binary_sensor
|
||||
import esphomeyaml.config_validation as cv
|
||||
from esphomeyaml.const import CONF_BINARY_SENSORS, CONF_ID, CONF_LAMBDA
|
||||
from esphomeyaml.cpp_generator import process_lambda, variable
|
||||
from esphomeyaml.const import CONF_BINARY_SENSORS, CONF_ID, CONF_LAMBDA, CONF_NAME
|
||||
from esphomeyaml.cpp_generator import process_lambda, variable, Pvariable, add
|
||||
from esphomeyaml.cpp_types import std_vector
|
||||
|
||||
CustomBinarySensorConstructor = binary_sensor.binary_sensor_ns.class_(
|
||||
@@ -26,8 +26,10 @@ def to_code(config):
|
||||
|
||||
rhs = CustomBinarySensorConstructor(template_)
|
||||
custom = variable(config[CONF_ID], rhs)
|
||||
for i, sens in enumerate(config[CONF_BINARY_SENSORS]):
|
||||
binary_sensor.register_binary_sensor(custom.get_binary_sensor(i), sens)
|
||||
for i, conf in enumerate(config[CONF_BINARY_SENSORS]):
|
||||
var = Pvariable(conf[CONF_ID], custom.get_binary_sensor(i))
|
||||
add(var.set_name(conf[CONF_NAME]))
|
||||
binary_sensor.register_binary_sensor(var, conf)
|
||||
|
||||
|
||||
BUILD_FLAGS = '-DUSE_CUSTOM_BINARY_SENSOR'
|
||||
|
Reference in New Issue
Block a user