A system for metering fluid in a dialysis device comprising: a fluid source storing a fluid; a fluid line coupled to the fluid source and configured to pass the fluid therethrough; a controller; a flowmeter coupled to the fluid line, the flowmeter configured to measure a flow rate of the fluid and provide a flow rate signal to the controller, wherein the flowmeter is at least one of an acoustic flowmeter or an optical flowmeter a pump coupled to the fluid line and configured move the fluid from the fluid source through the fluid line, wherein the controller is configured to meter the fluid by controlling the pump based on the flow rate signal, characterized in that the system further comprises: a valve coupled to the fluid line downstream of the fluid source and upstream of the flowmeter, the valve configured to switch between a first configuration and a second configuration, wherein in the first configuration the valve directs the fluid through the fluid line and in the second configuration the valve directs the fluid through a drain line; and a bubble detector coupled to the fluid line downstream of the fluid source and upstream of the valve, the bubble detector configured to detect bubbles present in the fluid and to generate a bubble detection signal, wherein the controller is coupled to the bubble detector and the valve, the controller being further configured to: receive the bubble detection signal; switch the valve to the first configuration in response to the bubble detection signal being below a threshold indicative of a presence of the bubbles in the fluid; and switch the valve to the second configuration in response to the bubble detection signal being above the threshold indicative of the presence of the bubbles in the fluid. a fluid source storing a fluid; a fluid line coupled to the fluid source and configured to pass the fluid therethrough; a controller; a flowmeter coupled to the fluid line, the flowmeter configured to measure a flow rate of the fluid and provide a flow rate signal to the controller, wherein the flowmeter is at least one of an acoustic flowmeter or an optical flowmeter a pump coupled to the fluid line and configured move the fluid from the fluid source through the fluid line, wherein the controller is configured to meter the fluid by controlling the pump based on the flow rate signal, characterized in that the system further comprises: a valve coupled to the fluid line downstream of the fluid source and upstream of the flowmeter, the valve configured to switch between a first configuration and a second configuration, wherein in the first configuration the valve directs the fluid through the fluid line and in the second configuration the valve directs the fluid through a drain line; and a bubble detector coupled to the fluid line downstream of the fluid source and upstream of the valve, the bubble detector configured to detect bubbles present in the fluid and to generate a bubble detection signal, wherein the controller is coupled to the bubble detector and the valve, the controller being further configured to: receive the bubble detection signal; switch the valve to the first configuration in response to the bubble detection signal being below a threshold indicative of a presence of the bubbles in the fluid; and switch the valve to the second configuration in response to the bubble detection signal being above the threshold indicative of the presence of the bubbles in the fluid. a valve coupled to the fluid line downstream of the fluid source and upstream of the flowmeter, the valve configured to switch between a first configuration and a second configuration, wherein in the first configuration the valve directs the fluid through the fluid line and in the second configuration the valve directs the fluid through a drain line; and a bubble detector coupled to the fluid line downstream of the fluid source and upstream of the valve, the bubble detector configured to detect bubbles present in the fluid and to generate a bubble detection signal, wherein the controller is coupled to the bubble detector and the valve, the controller being further configured to: receive the bubble detection signal; switch the valve to the first configuration in response to the bubble detection signal being below a threshold indicative of a presence of the bubbles in the fluid; and switch the valve to the second configuration in response to the bubble detection signal being above the threshold indicative of the presence of the bubbles in the fluid. receive the bubble detection signal; switch the valve to the first configuration in response to the bubble detection signal being below a threshold indicative of a presence of the bubbles in the fluid; and switch the valve to the second configuration in response to the bubble detection signal being above the threshold indicative of the presence of the bubbles in the fluid.