The present invention relates to an electrolytic device for a water supply system, comprising an electrolytic cell which is provided with electrodes over which a voltage difference is applied, characterized in that the voltage difference for the electrolytic cell is at least partially supplied by a generator which is driven by the water in the water supply system. The invention further relates to a method for disinfecting a water supply system by electrolysis.