A dialysis device for operation in multiple modes and for maintaining a known gradient of potassium ion or other electrolyte between the blood of a patient and a dialysate fluid is described. The dialysis device is capable of being used for hemodialysis or peritoneal dialysis, and the dialysis device is capable of operation with a dialysate purification unit outside of a clinical setting or with a supply of water that can be supplied in a clinical setting. The dialysis device has a composition sensor containing a potassium-sensitive electrode for measuring a potassium ion concentration in one or more of the patients blood and the dialysate fluid and an infusate pump operated to adjust a potassium ion concentration in the dialysate fluid based at least in part on data from the composition sensor.