In a world in which global warming is progressing and environmental problems are becoming increasingly severe, the use of energy with a low environmental load has become important. One way to solve this problem is the use of water heaters driven by a heat pump, a solution that has been widely implemented in residential homes. In this study, we endeavored to develop an optimal operation plan for the energy storage equipment in a residence. The proposed model is based on the idea of a smart community and aims to optimize electricity usage across multiple residences. We formulate the problem using a stochastic programming method with integer conditions to model the operation of complex equipment. Multiple scenarios were used to consider the uncertainty in the demand for both power and heat for a residence. The solution that is obtained corresponds to the operation of multiple models. The purpose of this study was to minimize the electricity charge and level the load in terms of the power supply. We aimed to reduce the maximum power consumption and average power demand relative to the separate electricity charges of individual homes and the demand at different times of the day.