def to_code(config): for template_ in process_lambda(config[CONF_LAMBDA], [], return_type=std_vector.template(sensor.SensorPtr)): yield rhs = CustomSensorConstructor(template_) custom = variable(config[CONF_ID], rhs) for i, conf in enumerate(config[CONF_SENSORS]): rhs = custom.Pget_sensor(i) add(rhs.set_name(conf[CONF_NAME])) sensor.register_sensor(rhs, conf)
def to_code(config): for template_ in process_lambda( config[CONF_LAMBDA], [], return_type=std_vector.template(ComponentPtr)): yield rhs = CustomComponentConstructor(template_) custom = variable(config[CONF_ID], rhs) for i, comp_config in enumerate(config.get(CONF_COMPONENTS, [])): comp = Pvariable(comp_config[CONF_ID], custom.get_component(i)) setup_component(comp, comp_config)
def to_code(config): for template_ in process_lambda(config[CONF_LAMBDA], [], return_type=std_vector.template(switch.SwitchPtr)): yield rhs = CustomSwitchConstructor(template_) custom = variable(config[CONF_ID], rhs) for i, conf in enumerate(config[CONF_SWITCHES]): rhs = custom.Pget_switch(i) add(rhs.set_name(conf[CONF_NAME])) switch.register_switch(rhs, conf)
def to_code(config): type = config[CONF_TYPE] if type == 'binary': ret_type = output.BinaryOutputPtr klass = CustomBinaryOutputConstructor else: ret_type = output.FloatOutputPtr klass = CustomFloatOutputConstructor for template_ in process_lambda(config[CONF_LAMBDA], [], return_type=std_vector.template(ret_type)): yield rhs = klass(template_) custom = variable(config[CONF_ID], rhs) for i, conf in enumerate(config[CONF_OUTPUTS]): output.register_output(custom.get_output(i), conf)