Valves combined with electrical components