A method for operating a valve, comprises directing fluid flow through a housing of the valve, wherein the fluid flows into the housing through a housing inlet and flows out of the housing through a housing outlet. The method continues by directing a first electric current into a solenoid coupled to the housing to generate a first magnetic field, wherein the first magnetic field exerts a force upon a plunger positioned inside the housing and causes the plunger to magnetically connect to a magnet. The method continues by directing a second electrical current into the solenoid to generate a second magnetic field, wherein the second magnetic field exerts a force upon the plunger causing the plunger to disconnect from the magnet and engage with the housing outlet. Fluid flows into the inlet through a milking hose, and fluid flows out of the outlet into a milking pipeline.