Abstract--The smart home contains a network that connects home elements like sensors, HVAC (heating, ventilation, and air conditioning), appliances and thermostat. In our previous work, we proposed an approach that used web services to remotely interact with smart home elements in a smart grid environment. These interactions include adjusting the temperature or reading energy consumption. We assumed a smart home with a wireless sensor network based on Zigbee. There was a central computer that could access all home elements. Business Process Execution Language (BPEL) was used to implement the web service on central computer. In this paper, we enhance the system by including new features. The algorithm to sell energy back to the grid has been further developed. Furthermore, a function to optimize energy using dynamic programming is added to the system. The performance and advantage of the communications between user and home elements via web services are demonstrated. Index Terms--dynamic programming; optimization; energy management; smart grids; smart homes; web services; wireless sensor network; zigbee. I. INTRODUCTION HE smart home is a dwelling incorporating a communication network that connects electrical elements (e.g., washer, HVAC (heating, ventilation, and air conditioning), thermostat) of a home, and allows them to be remotely controlled, monitored or accessed. Smart homes are typically used for security, energy management, comfort and health care. A smart home also contains a smart meter, which records energy consumption and transmits them wirelessly to the utility provider. A Web service (WS) describes a collection of operations that are accessible via internet through standardized XML (Extensible Mark-up Language) messaging. WS use XML to code and decode data and traditionally use SOAP (Simple Object Access Protocol) to transport it using existing protocols, like HTTP (Hypertext Transfer Protocol). The main advantage of WS is its interoperability. The client only requires the WSDL (Web service description language) definition to effectively exchange data with the service and neither part needs to know how the other is implemented. This work was partially supported by ORF-RE WiSense project. A. A. Khan and H. T. Mouftah are with School of Electrical Engineering and Computer Science, University of Ottawa, Ottawa, ON K1N6N5 Canada (e-mail: akhan083@site.uottawa.ca; mouftah@site.uottawa.ca). Therefore, it can be accessed by applications running on different platforms. Furthermore, WS can easily be accessed over the internet as it uses SOAP and HTTP for communications. SOAP can get around a firewall. Web services technologies are a set of technologies based on XML standards that help describe, access, and interact with WS. WS Framework consists of three platform elements: WSDL, UDDI (Universal Description, Discovery and Integration) and SOAP. WS technology is a XML-centric realization of Service- oriented architecture (SOA). When a client wants to use the web service, it searches for the specific service in UDDI. UDDI returns a WSDL file which describes the web service and its location. Clients use this information in the WSDL file to form a SOAP request to the designated computer offering the service. That computer performs the required operation and returns result via SOAP. Smart grid (SG) covers the generation, transmission and distribution of electricity to consumers. Building the SG means adding advanced computer and communications technology to the existing electricity grid and placing a networked sensor along wires to quickly prevent or locate a problem wirelessly. SG saves energy, reduces cost, increases reliability and transparency. Furthermore, it reduces emission of greenhouse gases and fosters demand response. SG also includes distributed and renewable generation resources like solar panels, wind turbine and Plug-in Hybrid Electric Vehicles (PHEV). These environment-friendly resources will enable a home to generate, consume, store and then sell energy back to the grid. The real-time, two-way communications available in a SG will enable the suppliers to observe the energy consumption of a house and send information to the consumers through a smart meter. Thus, SG enables the consumer to be more involved in order to optimize his energy consumption [1]. As energy costs are rising, more and more people are interested to reduce their energy consumption or shift their load to off-peak hours. The residential consumer wants to control temperature or appliance to reduce energy cost of home. Consumer also likes to interact with home devices remotely for comfort like remotely adjusting temperature or turning on coffeemaker before arriving home. The consumer should be able to carry out these functionalities quickly, remotely and securely. Web Services provide interoperability and are easily accessed over the Internet. The objective of this paper is to propose an approach that uses web services to remotely and efficiently interact with smart home devices to Energy Optimization and Energy Management of Home Via Web Services in Smart Grid Adnan A. Khan, Student Member, IEEE, and Hussein T. Mouftah, Fellow, IEEE T 2012 IEEE Electrical Power and Energy Conference 978-1-4673-2080-1/12/$31.00 ©2012 IEEE 14