An apparatus configured to be connected to a space heating unit and a water supply unit with a water tank so as to form a space heating circuit and a water supply circuit in which a heating medium is supplied to the space heating unit and the water supply unit, respectively, comprising: a heat pump unit having a compressor configured to compress a refrigerant, a first heat exchange means configured such that the refrigerant exchanges with ambient air therein, and a second heat exchange means configured such that the refrigerant exchanges heat with the heating medium; a circuit switching means configured to switch a flow circuit of the heating medium between the space heating circuit and the water supply circuit; an operation mode means configured to set an operation mode of the apparatus to a space heating mode or a water supply mode by controlling the circuit switching means such that the space heating circuit is activated during the space heating mode and the water supply circuit is activated during the water supply mode; and a heat pump control means configured to set an operation mode of the heat pump unit to a heating mode or a defrosting mode, the first heat exchange means working as an evaporator and the second heat exchange means working as a condenser during the heating mode, the first heat exchange means working as a condenser and the second heat exchange means working as an evaporator during the defrosting mode, and a detecting means configured to detect a temperature of the heating medium which has returned to the apparatus after circulating in the space heating unit or the water supply unit, characterized by a first determining means configured to determine, when the defrosting mode is set, the space heating mode is set, and the temperature detected by the detecting means is lower than a predetermined temperature, that the heating medium can freeze at the second heat means wherein when the defrosting mode is set and the space heating mode is set, the operation mode means is configured to switch the operation mode of the apparatus from the space heating mode to the water supply mode on condition that the first determining means has determined that the heating medium can freeze at the second heat means. a heat pump unit having a compressor configured to compress a refrigerant, a first heat exchange means configured such that the refrigerant exchanges with ambient air therein, and a second heat exchange means configured such that the refrigerant exchanges heat with the heating medium; a compressor configured to compress a refrigerant, a first heat exchange means configured such that the refrigerant exchanges with ambient air therein, and a second heat exchange means configured such that the refrigerant exchanges heat with the heating medium; a circuit switching means configured to switch a flow circuit of the heating medium between the space heating circuit and the water supply circuit; an operation mode means configured to set an operation mode of the apparatus to a space heating mode or a water supply mode by controlling the circuit switching means such that the space heating circuit is activated during the space heating mode and the water supply circuit is activated during the water supply mode; and a heat pump control means configured to set an operation mode of the heat pump unit to a heating mode or a defrosting mode, the first heat exchange means working as an evaporator and the second heat exchange means working as a condenser during the heating mode, the first heat exchange means working as a condenser and the second heat exchange means working as an evaporator during the defrosting mode, and a detecting means configured to detect a temperature of the heating medium which has returned to the apparatus after circulating in the space heating unit or the water supply unit, characterized by a first determining means configured to determine, when the defrosting mode is set, the space heating mode is set, and the temperature detected by the detecting means is lower than a predetermined temperature, that the heating medium can freeze at the second heat means wherein when the defrosting mode is set and the space heating mode is set, the operation mode means is configured to switch the operation mode of the apparatus from the space heating mode to the water supply mode on condition that the first determining means has determined that the heating medium can freeze at the second heat means.