See tap.py for pseudocode for 'Tappy' - a prototype tap attachment that uses computer vision to detect what you are doing with a tap and adjusts flow rate and duration to suit, improving water efficiency. Other files are early working versions of code for tappy.