Smart grid is the next generation of electricity generation, transmission and distribution technology. A major component of smart grid is an overlay communication network for two-way communication between the power providers and the customers. With this feature smart grid provides exciting new ways of energy management and conservation. One of ways to conserve energy using a smart grid is to control and optimize energy usage in buildings. Buildings consume more than one third of the energy produced in the world. Therefore, conserving energy in buildings is cited as the "most important fuel" in energy generation. To this end, we have developed a self-managing approach to optimize energy usage in buildings. We have evaluated our approach using a software tool called Power Conservation Analysis Tool (PCAT). Our initial results using PCAT show upto 38% savings in the energy bills of customers that could directly translates into reduction in energy production costs for power producers.