Fix custom_sensor codegen (#526)

This commit is contained in:
Anders Persson 2019-05-07 21:39:13 +02:00 committed by Otto Winter
parent c569d022ec
commit ebb5fadba1

View File

@ -20,6 +20,6 @@ def to_code(config):
rhs = CustomSensorConstructor(template_) rhs = CustomSensorConstructor(template_)
var = cg.variable(config[CONF_ID], rhs) var = cg.variable(config[CONF_ID], rhs)
for i, conf in enumerate(config[CONF_SENSORS]): for i, conf in enumerate(config[CONF_SENSORS]):
sens = cg.new_Pvariable(conf[CONF_ID], var.get_switch(i)) sens = cg.new_Pvariable(conf[CONF_ID], var.get_sensor(i))
cg.add(sens.set_name(conf[CONF_NAME])) cg.add(sens.set_name(conf[CONF_NAME]))
yield sensor.register_sensor(sens, conf) yield sensor.register_sensor(sens, conf)