I was thinking of doing something with a flow sensor and a solenoid valve when I realised I was perhaps over-thinking it: is there perhaps such a thing as a purely mechanical 4-port valve consisting of two isolated lines, where water flowing on the A/B line opens a valve allowing water to flow on the C/D line, somewhat analogously to an electric relay?
A ]===°===[ B
^
C ]===%===[ D
It seems like it should be possible with ball bearings and a springs(?) so I'm just wondering if it exists, and if so what it's called so that I can see if I can find a (not outrageously priced) suitable one for the project.