Anyone could have bought an off-the-shelf solenoid valve ... until it hits a limit switch. Those limit switches tell the microcontroller that the valve is either in the open or closed position.