Reducing energy consumption of solenoid valves