Abstract-The smart grid is the new generation of electricity grid that can efficiently utilize new distributed sources of energy (e.g., harvested renewable energy), and allow for dynamic electricity price. In this paper, we investigate the cost minimization problem for an end-user, such as a home, community, or a business, which is equipped with renewable energy devices when electrical appliances allow different levels of delay tolerance. The varying price of electricity presents an opportunity to reduce the electricity bill from an end-user's point of view by leveraging the flexibility to schedule operations of various appliances and HVAC systems. We assume that the end user has an energy storage battery as well as an energy harvesting device so that harvested renewable energy can be stored and later used when the price is high. The energy storage battery can also draw energy from the external grid. The problem we formulate here is to minimize the cost of the energy drawn from the external grid while usage of appliances are subject to individual delay constraints and a long-term average delay constraint. The resulting algorithm requires some future information regarding electricity prices, but it achieves provable performance without requiring future knowledge of either the power demands or the task arrival process. Moreover, we analyze the influence of the assumption that energy can be sold from the battery to the grid. An alternative algorithm is proposed to take advantage of the ability to sell energy. The performance gap between our proposed algorithm and the optimum is shown to diminish as energy selling price approaches the electricity price.