In the smart grid paradigm, residential consumers should participate actively in the energy exchange mechanisms by adjusting their consumption and generation. To this end, a proper home energy management system (HEMS), in addition to achieving a high level of comfort for the consumers, should handle the practical difficulties due to the uncertainty and technical limits. With this aim, in this paper, a new HEMS is proposed to carry out day-ahead management and real-time regulation. While an optimal scheduling solution based on some forecasted values of uncertain parameters is achieved for day ahead management, real-time regulation is accomplished by an adaptive neuro-fuzzy inference system, which can regulate the gaps between the forecasted and real values. Investigated case studies indicate that the proposed HEMS can find an optimal operating scenario with an acceptable success rate for real-time regulation.