mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 11:47:30 +01:00
Fix custom_sensor codegen (#526)
This commit is contained in:
parent
c569d022ec
commit
ebb5fadba1
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user