Rule for measure an amount

I have a meter that gives a number every 10:th second

I want to create a rule that takes a number item as input. When an input is given, the rule shall switch on a switch, this will enable the flow that the meter is measuring. When the meter measurement equals the input value I would like to switch off the flow.

I have made the rule to get the input and switch on the flow, but how shall I make the rule such that it switch off the flow?

rule "Meter Volume"
when
Item Meter_Test received update
then

	sendCommand(Meter_Switch, "ON")
	//when Measured_Value > (Measured_Value + Meter_Test) then switch off Meter_Switch
end

You need a separate rule that triggers when the Measured_Value Item changes. In that rule add your:

if(Measured_Value.state as Number > Measured_Value.state as Number + Meter_Test.state as Number) {
    Meter_Switch.sendCommand(OFF)
}

Thanks, now I got it to work!