Merge pull request #528 from emwap/patch-2

Further fix of custom_sensor codegen
This commit is contained in:
Otto Winter 2019-05-08 10:55:05 +02:00 committed by GitHub
commit 667457989e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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