Water Organs are one of the oldest automatic instruments. They are also known as the Hydraulic Organ. It not only had pipes, but it also had keys and levers that opened and closed the pipes and pumped the water inside. There was also a lever that helped to keep the organ running. You play it similarly to a piano and pushing the key pumps are. The air bounces on the water and make a sound. Each key pumps differently so each key make a different sound. The water organ was created by Ctesibius of Alexandria. This happened in the 3rd century BC.
Sources:
Wikipedia
Camera Zizario videos on Youtube
Sources:
Wikipedia
Camera Zizario videos on Youtube