Electronic Valves Inside Water

For an Arduino project I am in need of a sensor(valve type functionality) that can achieve the following - it would open when a liter bottle or container is empty and close when it is filled up to be released at other end. The same process would repeat again and again. The bottle would be kept inside a water tank

The issue that I am facing is that all electronics valves cannot be placed inside water - is there an alternative for same?

Is there a specific reason why you need all in one package and why you can't have the valve out of the water, on a pipe, as they are usually intended to be mounted, and have a separate sensors in the water?

Do you mean a sensor or a valve? A valve is a device for controlling liquid flow, not sensing
anything.

Perhaps you mean "switch" - ie a binary valued sensor?