A method of operating a heat pump, said heat pump comprising: - a warm liquid conduit for flow of warm heat transfer liquid though the conduit at a first temperature, said heat transfer liquid intended for heating of heat radiating elements in an enclosure, such as a building; - a cold liquid conduit for flow of cold heat transfer liquid from a cold thermal energy source and through the conduit at a second temperature, said second temperature being lower than the first temperature; and - a first heat exchanger with a first fluid circuit thermally coupled to the cold liquid conduit and for extracting thermal energy from the cold liquid to the first heat exchanger, and - a second heat exchanger with a second fluid conduit thermally coupled to the warm liquid conduit and for supplying thermal energy from the second heat exchanger to the warm liquid, and - an intermediate fluid conduit for flow of an intermediate heat transfer fluid between the first heat exchanger and the second heat exchanger said intermediate heat transfer fluid transferring thermal energy from the first heat exchanger to the second heat exchanger, and said intermediate fluid conduit comprising a compressor and an expansion valve between the heat exchangers, - a valve unit comprising at least one control valve in connection with the inlet of cold liquid circuit, said at least one control valve being a two-way valve for controlling the flow of the cold liquid, said two-way valve being positioned between a cold thermal energy source and the inlet of the first heat exchanger, and said valve unit comprising a sensor coupled to a heat pump controller controlling one or more operating parameters of the heat pump, - said controller monitoring the second temperature at a location between, and including, the inlet and the outlet of the first heat exchanger, and - said controller transmitting a signal to the valve unit at least when the temperature of the cold liquid is below a threshold temperature, and - said valve unit starting to increase the opening degree of the control valve when having received the signal from the controller, characterized in that - said controller transmitting the signal to the valve unit as long as the temperature of the cold liquid is below the threshold temperature, and - said valve unit continuously increasing the opening degree of the control valve as long as the valve unit is receiving the signal from the heat pump controller. - a warm liquid conduit for flow of warm heat transfer liquid though the conduit at a first temperature, said heat transfer liquid intended for heating of heat radiating elements in an enclosure, such as a building; - a cold liquid conduit for flow of cold heat transfer liquid from a cold thermal energy source and through the conduit at a second temperature, said second temperature being lower than the first temperature; and - a first heat exchanger with a first fluid circuit thermally coupled to the cold liquid conduit and for extracting thermal energy from the cold liquid to the first heat exchanger, and - a second heat exchanger with a second fluid conduit thermally coupled to the warm liquid conduit and for supplying thermal energy from the second heat exchanger to the warm liquid, and - an intermediate fluid conduit for flow of an intermediate heat transfer fluid between the first heat exchanger and the second heat exchanger said intermediate heat transfer fluid transferring thermal energy from the first heat exchanger to the second heat exchanger, and said intermediate fluid conduit comprising a compressor and an expansion valve between the heat exchangers, - a valve unit comprising at least one control valve in connection with the inlet of cold liquid circuit, said at least one control valve being a two-way valve for controlling the flow of the cold liquid, said two-way valve being positioned between a cold thermal energy source and the inlet of the first heat exchanger, and said valve unit comprising a sensor coupled to a heat pump controller controlling one or more operating parameters of the heat pump, - said controller monitoring the second temperature at a location between, and including, the inlet and the outlet of the first heat exchanger, and - said controller transmitting a signal to the valve unit at least when the temperature of the cold liquid is below a threshold temperature, and - said valve unit starting to increase the opening degree of the control valve when having received the signal from the controller, characterized in that - said controller transmitting the signal to the valve unit as long as the temperature of the cold liquid is below the threshold temperature, and - said valve unit continuously increasing the opening degree of the control valve as long as the valve unit is receiving the signal from the heat pump controller.