Home energy management system (HEMS) is essential for residential electricity consumers to participate actively in demand response (DR) programs. Dynamic pricing schemes are not sufficiently effective for end-users without utilizing a HEMS for consumption management. In this paper, an intelligent HEMS algorithm is proposed to schedule the consumption of controllable appliances in a smart household. Electric vehicle (EV) and electric water heater (EWH) are incorporated in the HEMS. They are controllable appliances with storage capability. EVs are flexible energy-intensive loads, which can provide advantages of a dispatchable source. It is expected that the penetration of EVs will grow considerably in future. This algorithm is designed for a smart household with a rooftop photovoltaic (PV) system integrated with an energy storage system (ESS). Simulation results are presented under different pricing and DR programs to demonstrate the application of the HEMS and to verify its' effectiveness. Case studies are conducted using real measurements. They consider the household load, the rooftop PV generation forecast and the built-in parameters of controllable appliances as inputs. The results exhibit that the daily household energy cost reduces 29.5%-31.5% by using the proposed optimization-based algorithm in the HEMS instead of a simple rule-based algorithm under different pricing schemes. (C) 2017 Elsevier B.V. All rights reserved.