An appliance for washing clothes includes a detergent storage tank and a drum. Between the detergent storage tank and the drum is a diverter valve which has a detergent inlet connected to the detergent storage tank, an air vent connected to ambient air, and a detergent outlet. The diverter valve has an energized state wherein the detergent inlet is open and the air vent is closed, and a de-energized state wherein the detergent inlet is closed and the air vent is open. The appliance also has a flow meter connected to the diverter valve and the drum.