A method for controlling an air conditioner, the air conditioner comprising at least one indoor unit, an outdoor unit connected to the at least one indoor unit, the outdoor unit comprising a compressor for compressing a refrigerant, an engine generating power by using combustion gas to operate the compressor, a generator generating electricity by using the power generated in the engine, and a battery receiving at least one portion of the electricity generated in the generator, the method comprising: controlling the air conditioner in mode (i) of charging or discharging of the battery while the air conditioner is operating, and controlling the air conditioner in mode (ii) of charging of the battery while operation of the air conditioner is stopped, wherein in mode (i), the air conditioner: calculates the operation performance of the air conditioner; and charges the battery by the generator, or discharges electricity stored in the battery to the indoor unit or the outdoor unit according to the calculated operation performance of the air conditioner, characterized in that in mode (ii), the air conditioner: a) detects an amount of electricity charged into the battery in a state where an operation of the air conditioner is stopped; b) compares the amount of electricity charged into the battery with a first preset reference value; c) activates a charging mode when the amount of electricity charged into the battery is less than a first preset reference value, or continuing with step a) when the amount of electricity charged into the battery is not less than the first preset reference value, d) compares the amount of electricity charged into the battery with a second preset reference value, wherein the second preset reference value is lower than the first preset reference value; and e) performs charging of the battery when the amount of electricity charged into the battery is less than the second preset reference value, or continuing with step c) when the amount of electricity charged into the battery is not less than the second preset reference value. controlling the air conditioner in mode (i) of charging or discharging of the battery while the air conditioner is operating, and controlling the air conditioner in mode (ii) of charging of the battery while operation of the air conditioner is stopped, wherein in mode (i), the air conditioner: calculates the operation performance of the air conditioner; and charges the battery by the generator, or discharges electricity stored in the battery to the indoor unit or the outdoor unit according to the calculated operation performance of the air conditioner, calculates the operation performance of the air conditioner; and charges the battery by the generator, or discharges electricity stored in the battery to the indoor unit or the outdoor unit according to the calculated operation performance of the air conditioner, characterized in that in mode (ii), the air conditioner: a) detects an amount of electricity charged into the battery in a state where an operation of the air conditioner is stopped; b) compares the amount of electricity charged into the battery with a first preset reference value; c) activates a charging mode when the amount of electricity charged into the battery is less than a first preset reference value, or continuing with step a) when the amount of electricity charged into the battery is not less than the first preset reference value, d) compares the amount of electricity charged into the battery with a second preset reference value, wherein the second preset reference value is lower than the first preset reference value; and e) performs charging of the battery when the amount of electricity charged into the battery is less than the second preset reference value, or continuing with step c) when the amount of electricity charged into the battery is not less than the second preset reference value. a) detects an amount of electricity charged into the battery in a state where an operation of the air conditioner is stopped; b) compares the amount of electricity charged into the battery with a first preset reference value; c) activates a charging mode when the amount of electricity charged into the battery is less than a first preset reference value, or continuing with step a) when the amount of electricity charged into the battery is not less than the first preset reference value, d) compares the amount of electricity charged into the battery with a second preset reference value, wherein the second preset reference value is lower than the first preset reference value; and e) performs charging of the battery when the amount of electricity charged into the battery is less than the second preset reference value, or continuing with step c) when the amount of electricity charged into the battery is not less than the second preset reference value.