If I understand correctly, to move the valve from one position to the other, I need to invert the connection on the two wires:
position 1: green to GND and red to (+)
position 2: red to GND and green to (+)
Yes. The valve have "end-stops" so leaving the switch in one position, won't make the valve to draw current, once it set up for position.
To drive this you need one of:
1. H-bridge circuit + control circuit,
2. 2 relays: 1x with two pole toggling contacts (DPDT/2PDT) + 1x with one normal open contact (SPST / SPDT),
3. 1x bi-stable relay with 2 toggling contacts (2PDT/DPDT) and with 2 coils (yes, they exists)
Ad. 1 - this is 4 transistors circuit, which is controlled from an dedicated IC (e.g. DC motor controller IC there are ICs that have already built-in H-bridge already) - with controller you need 2 GPIOs: one for "Enable" another one for "direction". This one is most pro approach to the problem, but also is rather difficult and not cheap.
Ad. 2 - relay with DPDT contacts you connect like in seller schematic, and the second one control power supply for the toggling one (so you don't have to keep the toggling one switched on constantly). This require two GPIOs too. This is cheapest and simplest solutions and do the trick really good (It's a little dirty but, uh well...)
Ad. 3 - You connect the relay contacts like in seller schematic, and you drive each coil to switch contacts to opposite state. Two GPIOs required. Not the cheapest, but will work fine too - that specific relay (two-coil latching (toggling) double pole double throw contacts) is a expensive thing compared to common relays (common relay is about 10x or more cheaper
I would use the 2 option
- I'm lazy and I don't like to spend money for exotics parts like latching-relay or DC motor controller (and parts for it's circuit)
I think I don't need to mention, that you have to use some circuit wit transistors to drive relays from GPIOs (I assume that by looking at your post count - you're not total green).
Ps. I think the better topic would be "Driving DC motor valve from GPIOs" or something alike... Oh, it just came to my mind: look up how to control DC motor in both direction from raspberry pi (There must be something).