A coffee machine comprising a device for providing liquid for the coffee machine, wherein the device encompasses: - a water tank having at least one water inlet for filling the water tank, said water inlet being configured to be connected in a controllable manner to a water connection, in particular to an overpressure water connection and preferably to a potable water supply, and having an outlet for letting a liquid out of the water tank; - a control device (30, 30a) for controlling the water inlet being configured to be connected in a controllable manner; and - at least one filling level sensor (41, 42) for generating a signal, which indicates at least whether or not a first filling level of liquid inside the water tank has been reached or exceeded, and wherein the coffee machine furthermore encompasses: - a water line, which is connected to the outlet of the water tank in such a manner that a liquid, which is let out of the tank through the outlet, is enabled to drain through the water line, - a continuous-flow heater and - a brewing unit for brewing coffee, which is connected to the water tank via the water line and the continuous-flow heater in such a manner that water from the water tank is enabled to be supplied to the brewing unit through the water line and the continuous-flow heater, so as to make it possible to brew coffee, wherein the at least one filling level sensor (41, 42) is configured to be connected or is connected to the control device (30, 30a) to transmit the signal, and wherein the control device (30, 30a) is designed to control the water inlet according to the signal of the at least one filling level sensor (41, 42) and according to at least one operating mode, wherein the operating mode is either a filling mode or an emptying mode, wherein the device furthermore encompasses a controllable drainage device for draining liquid from the water tank through the outlet, wherein, in the filling mode, the control device (30, 30a) is furthermore designed to connect the water inlet to the water connection when the first filling level has not been reached and has not been exceeded, and in the emptying mode, to interrupt a connection of the water inlet to the water connection independent from the first filling level, and wherein the control device (30, 30a) is designed to prompt the drainage device to drain liquid from the water tank by controlling the drainage device, characterized in that in the emptying mode, the control device (30, 30a) is designed to interrupt a connection of the water inlet to the water connection and to prompt the drainage device to completely drain a quantity of liquid contained in the tank through the outlet and to allow it to discharge through the water line and the continuous-flow heater, so that a complete emptying of the water tank takes place. - a water tank having at least one water inlet for filling the water tank, said water inlet being configured to be connected in a controllable manner to a water connection, in particular to an overpressure water connection and preferably to a potable water supply, and having an outlet for letting a liquid out of the water tank; - a control device (30, 30a) for controlling the water inlet being configured to be connected in a controllable manner; and - at least one filling level sensor (41, 42) for generating a signal, which indicates at least whether or not a first filling level of liquid inside the water tank has been reached or exceeded, - a water line, which is connected to the outlet of the water tank in such a manner that a liquid, which is let out of the tank through the outlet, is enabled to drain through the water line, - a continuous-flow heater and - a brewing unit for brewing coffee, which is connected to the water tank via the water line and the continuous-flow heater in such a manner that water from the water tank is enabled to be supplied to the brewing unit through the water line and the continuous-flow heater, so as to make it possible to brew coffee, wherein the at least one filling level sensor (41, 42) is configured to be connected or is connected to the control device (30, 30a) to transmit the signal, and wherein the control device (30, 30a) is designed to control the water inlet according to the signal of the at least one filling level sensor (41, 42) and according to at least one operating mode, wherein the operating mode is either a filling mode or an emptying mode, wherein the device furthermore encompasses a controllable drainage device for draining liquid from the water tank through the outlet, wherein, in the filling mode, the control device (30, 30a) is furthermore designed to connect the water inlet to the water connection when the first filling level has not been reached and has not been exceeded, and in the emptying mode, to interrupt a connection of the water inlet to the water connection independent from the first filling level, and wherein the control device (30, 30a) is designed to prompt the drainage device to drain liquid from the water tank by controlling the drainage device, characterized in that in the emptying mode, the control device (30, 30a) is designed to interrupt a connection of the water inlet to the water connection and to prompt the drainage device to completely drain a quantity of liquid contained in the tank through the outlet and to allow it to discharge through the water line and the continuous-flow heater, so that a complete emptying of the water tank takes place.