Energy Management for Smart Homes—State of the Art

: Smart home is a concept that aims to enhance the comfort of residents and facilitate household activities. The smart home is an application of ubiquitous computing which can provide the user with context-aware automated or assistive services in the form of ambient intelligence, remote control of home appliances, or automation. Smart homes attempt to integrate smartness into homes to guarantee the residents’ convenience, safety, and security, while conserving the energy. The capabilities of a smart home in the context of di ﬀ erent applications, have been scrutinized for this investigation. Di ﬀ erent proposed architectures, protocols, and infrastructures have been taken into consideration. As the data management process is a vital part of a smart home system, many procedures of data collection, storage, and analysis have been surveyed. Methods of data acquisition has also been discussed. Existing challenges, pros, and cons of proposed schemes along with future perspectives of smart homes are identiﬁed in this report, which is intended to promote future research directions.


Introduction
Smart homes are an application of ubiquitous computing. Homes can be augmented with information and communication technologies (ICT) to provide the user with context-aware automated or assistive services in the form of ambient intelligence, remote home control, or home automation. To guarantee the residents' convenience, security, and safety along with effective energy management within the residence, smart homes incorporate "smartness" into dwellings. Smart house, home automation, intelligent home, adaptive home, and aware house are synonyms used in literature for referring to the smart home [1].
In 1992, Lutolf provided the first definition for a smart home [2]. According to Lutolf, "the smart home concept is the integration of different services within a home by using a common communication system. It assures an economic, secure, and comfortable operation of the home and includes a high degree of intelligent functionality and flexibility." This definition mostly emphasizes on home automation and does not consider intelligence and its application in a home [1]. Intelligence is significantly different to automation. Automation can be considered as a subset of an intelligence system; it encompasses a limited number of tasks and does not need an overall image of the environmental situation. The intelligence system has an overall image about the environmental situation, the tasks that are going on, and it is also able to predict the upcoming situation and make decisions to guarantee the safety and convenience of the residents [3]. Appl In 2003, Intertek [4] published an elaborated definition for a smart home: "A smart home is a residence incorporating a communications network between electric household appliances and services". Intertek's definition emphasizes on remote access (to control or monitor) of the smart homes [1].
In 2006, Satpathy [5] provided a more intelligence-emphasized view of smart homes. According to Satpathy, "a home which is smart enough to assist the inhabitants to live independently and comfortably with the help of technology is termed as smart home. In a smart home, all the mechanical and digital devices are interconnected to form a network, which can communicate with each other and with the user to create an interactive space". In this regard, the definitions of smart or intelligent also needs to be considered. According to Edwards and Grinter [6], a system needs to have the four following abilities to be called smart or intelligent in the smart home concept: 1.
The ability to process the collected information from sensors to recognize the environmental situation. 2.
The ability to figure out its state by considering multiple factors at once. 3.
The ability to predict the user intent by analyzing the current situation. 4.
The ability to preemptively act based on the intent assumption.
A smart or intelligent environment can be considered as an agent that has the ability to assess the residents' position, state, and physical surroundings by processing the sensory data, and then make the required changes in the environment by using actuators to improve the energy efficiency within the home while keeping residents' comfort at an acceptable level [7,8].
According to Darby [9] two kinds of definitions could be given for a smart home: Home-and user-focused definition and building-and system-focused definition. The former definition emphasizes comfort and convenience of buildings occupants while the latter definition concentrates on improving building energy performance. In both definitions the smart home required several communication links between devices, sensors, and actuators to be able to provide services.
Energy consumption has increased due to the rising population and expanding economy. The energy consumption will continue to increase with improved quality of life and the increment rates are expected to continue. More energy usage will lead to more greenhouse gas (GHG) emissions; this will have a serious impact on the global environment. In 2004, the building energy usage in the EU was 37% of the final energy, higher than other sectors such as the industry (28%) and transport (32%). Unlike the other sectors, there are great and attractive opportunities for reducing buildings' energy consumption to have lower costs and higher returns. In 2017, the international energy agency (IEA) reported that employing digital technologies could reduce the energy consumption by 10% by exploiting real-time data to improve operational efficiency. In addition, smart demand-side responses could provide 185 gigawatts (GW) of system flexibility and avoid costly upgrades to electricity grids.
In 2007, energy consumption in the residential sector represented 21% of the total US demand. After the initial increase from 17% in 1950 to 20% in 1960, the amount has remained between 19% and 22% till today [10]. A great amount of home energy is consumed in an inefficient manner. Reports show that 40% of the global power consumption takes place within residential buildings [11]. The poor technology of energy management systems is the reason of this waste in homes. Technological systems can be improved using IT systems and their abilities for data management and processing. IT based monitoring and controlling technologies can play a significant role in energy management within homes; they have successfully eliminated the waste of energy in other sectors. While simple programmable thermostats were used by 28% of US homes in 2005, only 16% of these homes utilized the programmable function of their device [12]. An IT system can provide real-time energy consumption feedback to the occupant. It can provide useful details about the energy consumption of appliances during different times of the day and the total consumption of each section within the home, such as kitchen, rooms, etc. This information will be an economic motivation for consumers to improve their energy efficiency and change their energy consumption habits.
Sustainable development requirement and significant raise in energy costs have necessitated the reduction in energy consumption without compromising occupants' comfort. Deploying intelligent energy management systems in buildings will lead to energy and cost savings. In this regard, the smart home concept has attracted great attention in the last decade because of its potentials in providing comfort and energy management to occupants.
The concept of "smart city" is now also well established. Smart city systems not only improve the inhabitants' comfort, but also makes improvement in the efficient management of asset; this includes smart transportation systems, smart energy grids, and environmental monitoring. As a city's founding elements, smart homes can exchange information with the city and coordinate activities essential to a smart city.
The motivation for this study is to identify and review smart home design/operation concepts and technologies that can reduce energy consumption without compromising occupants' comfort. The study considers both the user-and building-approaches. Section 2 reviews several types of smart home architectures and focuses on Cloud-based architecture models. Section 3 is an overview of communication protocols used by interconnected devices in a smart home. Section 4 is a review of sensor technologies in a smart home; how sensor technologies can be used to monitor energy performance and associate them with household activities is addressed. Section 5 is a review of the inhabitants' activity and concentrates on activity recognition and discovery approaches. Section 6 is an overview of smart schemes for energy management and briefly touches upon building energy system modelling and on the connection of smart homes and smart grids. A review of perspectives on future smart homes is provided in Section 7. The final Section 8 is a summary with major conclusions.

System Architecture
A smart home is the incorporation of automation (not smartness) and intelligent systems (smartness). Devices such as sensors and appliances (automation) are used to monitor and collect environmental information. These data can be stored and analyzed by the intelligent systems, and necessary changes to the environment are implemented through actuators based on the results of the analysis.
A smart home architecture should be deployed in a manner that satisfies the requirements of metering home conditions, processing instrumented data, and monitoring home appliances. Generally, a smart home architecture includes the following main elements [13]: • Microcontroller-enabled sensors to monitor home conditions. • Database/Data Store to store generated sensory data and cloud services for data analysis and visualization; also serves as a queue for commands being sent to actuators. • Microcontroller-enabled actuators to implement required changes within the environment; microcontrollers send commands to actuators via the cloud services. • Server/API layer to process the received sensory data and store the data in database. In addition to the sensory data, it stores the control commands received from web applications and provides the commands to actuators upon their requests.

•
Web applications serve as a cloud service to facilitate the measuring and visualization of sensory data, and to enable remote control (via mobile device) of appliances.
There are many types of architectures proposed for smart homes. The system-based architecture, proposed by Soliman et al. [13], is a scheme of sensors and actuators connected to the microcontroller. Sensors collect information about the environment and the microcontroller makes required changes to the environment through actuators. The physical layer-based architecture, proposed by Cook et al. [14], consists of computer servers, environmental monitoring sensors and detectors, and actuators. The scalable model architecture, proposed by Jie et al. [15], uses a uniform interface model to add or remove the model from the infrastructure of smart homes with less effort. The cloud-based architecture (CloudThings), proposed by Zhou et al. [16], aims to speed up the Internet of things (IoT) application, development, and management by providing Internet access to end devices. A simplified cloud-based architecture is illustrated in Figure 1. The internal network consists of appliances, sensors, and actuators. These devices communicate with a gateway located at the network edge which connects the local network to a wide area network such as the Internet. The gateway is a key component of the cloud-based architecture. It supports multiple communication protocols and can easily communicate with end devices [17]; it also has sufficient processing power to perform some data processing before pushing it to the cloud. In addition, the gateway plays a network security layer role for the smart home. Since all communication among the end devices and the outer networks should pass through the gateway, it has the ability to filter the messages before commands make any changes to the end devices which do not possess high level of security and are more vulnerable to attacks [3]. sensors, and actuators. These devices communicate with a gateway located at the network edge which connects the local network to a wide area network such as the Internet. The gateway is a key component of the cloud-based architecture. It supports multiple communication protocols and can easily communicate with end devices [17]; it also has sufficient processing power to perform some data processing before pushing it to the cloud. In addition, the gateway plays a network security layer role for the smart home. Since all communication among the end devices and the outer networks should pass through the gateway, it has the ability to filter the messages before commands make any changes to the end devices which do not possess high level of security and are more vulnerable to attacks [3]. By employing Internet-connected devices, smart homes face privacy and security concerns in general. Interested readers may find a detailed review of these concerns in our previous study [3]. In a smart home, information collected by different resources can be aggregated and processed in the cloud. The cloud is the highest level of the architecture [18] which provides reliable, scalable and autonomous data storage, and the necessary infrastructure for data processing [19], [20]. The cloud-computing model had a good performance in the last decade; however, recently due to the increase in the number of IoT devices uploading data onto the cloud, this model has faced some problems. The most critical problem is the bandwidth limitation. Although CPU processing power had increased during the last decade, the bandwidth for data transmission did not [21]. As a result, the network bandwidth has become a bottleneck that affects the performance of the cloud -based architecture. To alleviate this problem, Fog and Edge computing were proposed.
In Fog computing, first coined by Cisco in 2014 [22], the processor is brought closer to where data are generated. The data processing is done between the source and the cloud, prior to being pushed to the cloud. In a smart home with the fog computing architecture, a gateway will do data processing since the gateway is closer to the data source. Data transmission between end devices and gateways is sped-up. The gateways will compress the data received from various sources and will send the compressed data to the cloud for further computation. Less bandwidth is needed to transmit  By employing Internet-connected devices, smart homes face privacy and security concerns in general. Interested readers may find a detailed review of these concerns in our previous study [3].
In a smart home, information collected by different resources can be aggregated and processed in the cloud. The cloud is the highest level of the architecture [18] which provides reliable, scalable and autonomous data storage, and the necessary infrastructure for data processing [19,20]. The cloud-computing model had a good performance in the last decade; however, recently due to the increase in the number of IoT devices uploading data onto the cloud, this model has faced some problems. The most critical problem is the bandwidth limitation. Although CPU processing power had increased during the last decade, the bandwidth for data transmission did not [21]. As a result, the network bandwidth has become a bottleneck that affects the performance of the cloud -based architecture. To alleviate this problem, Fog and Edge computing were proposed.
In Fog computing, first coined by Cisco in 2014 [22], the processor is brought closer to where data are generated. The data processing is done between the source and the cloud, prior to being pushed to the cloud. In a smart home with the fog computing architecture, a gateway will do data processing since the gateway is closer to the data source. Data transmission between end devices and gateways is sped-up. The gateways will compress the data received from various sources and will send the compressed data to the cloud for further computation. Less bandwidth is needed to transmit to the cloud in comparison with the original method [3]. Fog computing offers several advantages such as deduction of data size sent to the cloud, reducing the latency of network, improving the response time of the system and single point of failure avoidance [23]. However, Fog computing has some security weaknesses and privacy issues [24,25]. In comparison with Fog computing, Edge computing gives each end device the capability to decide if the data need to be stored locally, analyzed locally, or need to be sent to the cloud [3]. Edge computing has a more localized or at-source computation. Edge computing has the similar advantages and disadvantages as Fog computing [26,27].

Communication Protocols
In a smart home, devices need to communicate with each other to be able to exchange data. For making an efficient decision and changes, the intelligence system needs to have a detailed image of the environment. As a single sensor is not enough, several sensors are needed to collect various type of useful information (temperature, humidity, occupant's behaviour, etc.). To expand the functionality of collected information, sensors need to communicate as well. Communication protocols determine the manner in which these devices and sensors can mutually interconnect [3].
Smart home networks are expected to be based on wireless sensor networks and machine-to-machine (M2M) communications protocols [28]. Considering the transmission medium, the communication protocols are classified into following groups: Wireless 3.
Hybrid (which use both wired and wireless media) Body area networks (BAN), personal area networks (PAN), and local area networks (LAN) are the most common type of area networks used in smart homes [3]. Among different network topologies, a mesh network is the ideal one for wireless communication indoors because of obstacles such as walls and furniture [19].
Choosing the right communication protocol could be done based on the case and the following concerns [3]:

Wireless Communication Protocols
The protocols use radio frequency (RF) signals for transmitting and receiving data. The protocol has lower setup costs and has the ease of network expansions. Wireless communication protocols can be categorized as shown in Table 2 [3]. Advantages and disadvantages of wired and wireless communication protocols are summarized in Table 3.

Sensors in Smart Home
A smart home aims to improve its occupants' security, convenience, and energy management by facilitating the information and communication technologies. One of the most influencing factors on home energy usage is occupant behaviour. There are many environmental parameters that can be measured in a smart house, such as room temperatures, humidity, etc. These sensors have been described and investigated in many other studies; thus, they are not addressed in this report. This section concentrates on sensors that can be used to extract occupants' behaviour information; the following section will focus on tracking inhabitants' activity.
Monitoring and classification of residents' activities strongly depend on the sensor's and reliability. Sensor effectiveness largely depends on the type of activity which needs to be monitored [32]. Two main categories of sensors can be distinguished [33]: Wearable and nonwearable sensors. While wearable sensors allow for higher localization accuracy and can detect body movements and vital health metrics [34], nonwearable sensors are considered less intrusive and do not require any interaction from the user's side. Wearable sensors may also have harsher power consumption requirements. However, in some cases, the wearable sensors might be part of or make use of devices the user is familiar with and normally carries with them, such as a wristwatch or a cell phone [33].

Wearable Sensors
Wearable sensors aim to measure the motion characteristics, location, pulse rate, body temperature, blood pressure, and other vital signs of users. These sensors are usually attached to a person directly (e.g., bracelet sensors or cardio sensors) or attach to their clothes (e.g., an accelerometer or a step counter). Table 4 is a summary of wearable sensors that are used for activity recognition and activities of daily living (ADL) classification. • Accelerometers-Accelerometers are the most popular sensors for movement and activity recognition [35,36]. These sensors usually attached to a specified part of the human body. Location accelerometers are able to distinguish various types of movement (e.g., running, walking, sitting, scrubbing, etc.) [37,38] or assist to figure out the user posture [39]. Sometimes, accelerometers are employed to detect falls by measuring acceleration [40]. To improve the accelerometers performance and enrich the collected information, accelerometers are often employed together with gyroscopes [41].

•
Hand-worn sensors-These sensors are widely used in several activity recognitions. Wristwatches, magnetic sensors, and other types of bracelets are classified into this group. To improve the wristwatch ability in hand gesture recognition, accelerometers are integrated to wristwatches [42]. J. Merilahti et al. [43] employed a wrist-worn activity detector to classify users' sleep/awake activities. K. Van Laerhoven et al. [44] combined inertial sensors, accelerometers, and tilt switches in a wrist-worn sensor to recognize the daily activities of the user. Since different electrical devices emit different magnetic fields, hand-worn magnetic sensors which have the capability to distinguish differences among magnetic fields are employed to recognize the activity of a user [45]. Usually emergency buttons are designed for wristwatch, which can be used to ask for help [46].
• Smartphones-Various ranges of sensors such as accelerometers, gyroscopes, a global positioning system, a magnetometer, and a microphone integrated in smartphones. These sensors provide rich information about the user's movement and activities [47,48]. • RFID tags-These types of sensors are mostly used for finding the interaction of occupants with particular objects and for detecting the cooking, eating, and drinking within the home, Sangho Park et al. [49] attached RFID tags on various kitchen utensils such as cutlery and dishes. Similar setups are also considered in [50][51][52]. RFID tags are used for dressing failures detection by Matic et al. [53].
Often, RFID sensors are used in combination with other sensors such as accelerometers [54].
In addition to these sensors, there is also a large variety of sensors that monitor persons' vital signs [33]. These sensors allow for the monitoring of a large set of human vital signs, anomaly detection, and supporting activity recognition and classification.

Nonwearable Sensors
Nonwearable sensors are usually installed in fixed objects or locations of a house or a room and can detect occupants and their movements. Nonwearable sensors have the capability to identify the usage of objects, measure water flow, room temperature, or door openings/closings. Table 5 is a summary of different types of nonwearable sensors which were used for monitoring the occupants' daily activities. Ultrasonic sensors-Based on their capability for distance measurement, these sensors are usually used for occupant localization and presence detection. In some studies like [62][63][64], a combination of ultrasonic sensors together with other sensors were employed for monitoring the occupants daily behaviour. In other studies, ultrasonic sensors were used to obtain precise pacing trajectories and to be able to recognize the ones that were abnormal [65,66]. • Photoelectric sensors-These sensors have the capability to detect a light. When the intensity of lighting becomes greater or less than a threshold value, the device would be triggered and generate a signal. This type of sensor is not widely used; however, in some projects, they are used as a presence detection sensor [46,67,68].

•
Video-based sensors-In some monitoring approaches a camera is mounted in a particular location of a house for movement and activity detection. It should be noted that the performance of video-based sensors can be affected in an environment with low lights [69]. However, a video camera-based approach can violate the privacy of the residents. In this regard, low-resolution thermal sensors have been proposed to be used instead of a video camera to mitigate the privacy concerns [70,71]. • Vibration sensors-These sensors have the capability to detect a person falling [61,72], identifying interaction with various objects [73], flushing toilets, or detecting water flows [74,75]. • Pressure sensors-These sensors are mostly used for steps and fall detection. They are usually deployed in the floor of the monitoring space [46,61]. Joon-Ho Lim et al. [76] installed pressure sensors not only in floors but also in furniture to find useful activity information.

•
Magnetic switches-They are usually employed to find whether doors or cupboards are opened or closed. These sensors have the ability to provide information on users entering specific rooms and opening dressers, refrigerators, or trash cans [33].

•
Audio sensors-They are employed to detect sounds in houses and distinguish various types of sounds. In [63,77] microphones were installed for sounds classification and identifying speech, phone ringing, dish clanging. M. Popescu et al. [78] installed a series of acoustic sensors to detect a person falling.

•
Wattmeter-A Wattmeter and other sensors that meter electricity usage of household appliances and light are often used in determining activities of daily living. Today, electricity consumption can be considered as one of the main indicators of well-being of a resident [79]. G. C. Franco et al. [80], considered electricity consumption of room lights and different appliances to record electrical activities and recognize specified activities of daily living. Tang Yi Ping et al. [81] monitored domestic energy together with other sensors to find abnormalities and monitor the person's well-being and safety status.
It is necessary to mention that sensors with the ability to provide rich information about occupants' activities and biometrics can raise serious privacy concerns. Figure 2 shows the richness of the sensory data versus the privacy concern. As the figure illustrates, the sensors that provide rich information about their users rarely can be perceived as privacy-preserving. For example, the video camera provides detailed information about all residents' activities but cannot be used in most rooms due to heavy privacy violations. In contrast, magnetic switches can be deployed in every place within the house, but they do not provide complete information about every human activity. The data richness of magnetic switches or any other low-informative sensors can be partly improved by the usage of multiple instances of these sensors. However, this comes at the increased installation cost and deployment complexity [33].
Appl. Sci. 2018, 8, x FOR PEER REVIEW 9 of 23 • Vibration sensors -These sensors have the capability to detect a person falling [61], [72] , identifying interaction with various objects [73], flushing toilets, or detecting water flows [74], [75]. • Pressure sensors -These sensors are mostly used for steps and fall detection. They are usually deployed in the floor of the monitoring space [46], [61]. Joon-Ho Lim et al [76] installed pressure sensors not only in floors but also in furniture to find useful activity information.

•
Magnetic switches -They are usually employed to find whether doors or cupboards are opened or closed. These sensors have the ability to provide information on users entering specific rooms and opening dressers, refrigerators, or trash cans [33].

•
Audio sensors -They are employed to detect sounds in houses and distinguish various types of sounds. In [63], [77] microphones were installed for sounds classification and identifying speech, phone ringing, dish clanging. M. Popescu et al [78] installed a series of acoustic sensors to detect a person falling.

•
Wattmeter -A Wattmeter and other sensors that meter electricity usage of household appliances and light are often used in determining activities of daily living. Today, electricity consumption can be considered as one of the main indicators of well-being of a resident [79]. G. C. Franco et al. [80], considered electricity consumption of room lights and different appliances to record electrical activities and recognize specified activities of daily living. Tang Yi Ping et al. [81] monitored domestic energy together with other sensors to find abnormalities and monitor the person's well-being and safety status. It is necessary to mention that sensors with the ability to provide rich information about occupants' activities and biometrics can raise serious privacy concerns. Figure 2 shows the richness of the sensory data versus the privacy concern. As the figure illustrates, the sensors that provide rich information about their users rarely can be perceived as privacy-preserving. For example, the video camera provides detailed information about all residents' activities but cannot be used in most rooms due to heavy privacy violations. In contrast, magnetic switches can be deployed in every place within the house, but they do not provide complete information about every human activity. The data richness of magnetic switches or any other low-informative sensors can be partly improved by the usage of multiple instances of these sensors. However, this comes at the increased installation cost and deployment complexity [33].

Inhabitants' Activity Tracking
An important factor that influences energy consumption within the home is occupant behaviour. Tracking the occupants' activity within the home or, in other words, activity discovery, recognition, and prediction play a significant role in a smart home concept. This can be called the vital part of a smart home system due to its effect on both occupants' comfort and building energy management. "Action" and "activity" are the terms that are commonly used for describing physical behaviours. They are used interchangeably in some cases but in other cases they are used to interpret different complexity and duration of behaviours [82].
The occupants' activity can be goal-oriented, and it could be complicated. The activity could be as simple as a single objective and collection of serial events or it could be as complex as a multi-objective and non-sequential collection of happenings. Concurrent and interleaved activities can be considered as a complex activity. Consider the following as an example of a concurrent activity: An occupant in his activity of going to the bathroom passes by the laundry room to load and schedule the washing machine. In this example, there are two purposes in the activity: Scheduling the washing machine and taking a shower. As an example of the interleaved activity, consider the occupant responding to a ringing-phone while cooking in the kitchen. In this scenario the occupant should stop the cooking activity and pick up the phone; when the conversation is finished, the occupant returns to the cooking activity [83].
As discussed in the previous section, tracking the occupants' activity depends on the type and accuracy of sensors used within the house. In addition to the sensors, for monitoring the occupant's activity at the household, a smart home system needs to use activity recognition mediums. The smart home system needs to be able to recognize the occupant's activities, so it is necessary that the activities be categorized based on types or significant features. As sensory data has a temporal-ordered nature, the recognition-of-activity classification would be equally challenging as the sequence classification (SC) problem. There are three general SC methods [84]: In the featured-based methods, first a sequence will be transformed into a feature vector and then conventional classification methods such as k-gram and pattern-based feature selection will be applied [85]. In the sequence distance-based methods, the similarity of the sequences will be measured by the distance function and then the classification quality will be determined (e.g., K nearest neighbour classifier and support vector machine) [86], model-based methods using the Hidden Markov Model (HMM) and other statistical models for sequence classification [87].
Generally, the data generated by sensors can be analyzed from two aspects: Lower-sensory level and higher-activity level [88]. The lower-level analysis classifies activities using data read from the sensors. The higher-level analysis analyzes the classified labels of activities for further processes of decision-making. In the lower-level analysis, according to the availability of data instance, supervised learning is employed to learn the data instance model. This process is well known as activity recognition (AR). To discover activity labels without having data instance, an unsupervised learning approach can be used, popularly known as the activity discovery (AD) process. There are a variety of classification techniques such as information theory, statistics, machine learning, data mining, ontologies, and others.

Activity Recognition
"The process of matching predefined activity classes to the data received from sensors is called activity recognition" [14], which is a supervised learning approach. The recognition algorithm could be a support vector machine (SVM), decision tree (DT), instance-based learner (IB) or a neural network (NN) [89]. The activity recognition process can be roughly characterized by following steps [82]: • Selection and installation of suitable sensors for monitoring a user's activity together with changes in the environment.

•
Collecting, saving, and processing perceived information through data analysis techniques and/or knowledge representation formalisms at proper levels of abstraction.

•
Creating computational activity models in a manner that enable software systems/agents to conduct reasoning and manipulation. • Selection or development of reasoning algorithms to infer activities from sensor data.
Considering the sensor types for activity monitoring, activity recognition can be divided to two categories [82]: • Vision-based activity recognition: It is based on visual sensors deployment, like video cameras, for monitoring a person's behaviour within the environment. The generated sensory data are video sequences or digitized visual data. The methods in this category use computer vision techniques, including feature extraction, structural modelling, action extraction, movement tracking and segmentation, for analyzing visual observations for pattern recognition.

•
Sensor-based activity recognition: It is based on the use of sensor technologies to monitor activities. The generated sensory data are mainly the time series of state changes and/or various parameter values that are usually processed through data fusion, probabilistic, or statistical analysis approaches, and formal knowledge technologies for activity recognition.

Activity Discovery
There are always data that does not belong to any of the targeted classes of activity. One solution for handling unlabeled data is designing an unsupervised learning method [14,90] to recognize activities from unlabeled sensor data. Unsupervised learning can be defined as the process of data analysis for knowledge discovery or required data pattern by finding the repetition of data co-occurrence in sensory data. It is important to discover activity patterns from unlabeled data; this can be used to characterize and analyze as much behavioural data as possible, not just predefined activity classes. Researchers need to test and model such unlabeled data to find a complete view of everyday life [14].
To improve the performance of activity recognition, unlabeled data should be segmented into smaller classes. The association rule mining (ARM) analysis is an example of this approach. Activity discovery possesses the challenge of sequence mining; an example of sequence mining is the episode discovery (ED) algorithm [90] and greedy search [14]. In the episodic discovery a predefined window size will be moved along sensory data for collecting the interesting sequences. Later, for evaluating the sequences, the minimum description length (MDL) principle is applied to evaluate sequences by considering their length, frequency of occurrence, or periodicity. For finding the sequence (i.e., sensor's events) it is best to compress the input dataset and removed redundancy. The greedy search algorithm is best suited. Activity prediction will enable the smart home to react along the occupants' actions. The smart home needs to figure out the human activity in real time which would be possible by enhancing the activity recognition and prediction capability of the smart home. Many studies have been done in this regard.

Energy Management
Optimization of energy consumption while preserving residents' convenience is one of the most significant intentions of a smart home. Building energy and comfort management (BECM) systems are proposed as control systems for individual buildings or groups of buildings which performs monitoring, data storage, and communication utilizing computers and distributed microprocessors [91]. BECM aims to attenuate energy consumption within building operations while attaining acceptable levels of convenience for occupants. Heating, ventilation, and air conditioning (HVAC) control, hot water control, lighting control, and electricity control are often considered as necessary functions of the BECM system. This section propounds smart energy management schemes by focusing on the energy system modelling and the correlation of smart homes and smart grids.

Smart Home and Smart Grid
As energy consumption has become a global concern within the last decade, energy efficiency and utilization of renewable energy resources became feasible with the advent of the smart grid (SG) concept and modernizing the electricity grid. A significant number of SG infrastructure specifications presented in the earliest first official definition [92], is in affiliation with smart homes, such as demand-side management and timely provision of energy price information.
A smart grid can significantly enhanced energy efficiency within distributed networks and demand response (DR) is considered a substantial characteristic of a smart grid [93]. Within smart homes the cooperation of low precedence home appliances like washing machines and water heaters allows DR to utilize energy sources at lower prices. Energy scheduling can be classified as scheduling the resource of energy (i.e., when particular energy sources are utilized), and scheduling the consumption of energy (i.e., when various home appliances should be operating).
The smart home energy management system (HEMS) is introduced as a device operating within the building to collect, store, and analyze the energy consumption information of the home. HEMS schedules the operating time of appliances in order to augment the efficiency and attenuate the electricity expenditure, taking into account if the usage of appliances are schedulable or not [94]. A smart grid is dependent on smart homes. Homes that utilize smart appliances enables data collection via sensors and smart meters, which facilitates optimization of electricity requirements and reduces the electricity cost. Smart grids can also take advantage of the electricity generated on-site and exported to the grid.

Smart Energy Management
Although the energy management term has been employed in various investigations, in this work our focus is on buildings' energy management which involves internal heat gain and occupant comfort. The driven loads and heat gains of appliances has two categories. The first category correlates with responsive loads and specifies that the user can change the behaviour of the appliance because of a price signal, such as lights, plug loads, washing machines, dryers, dishwashers, cooking stoves, and microwaves. The second category correlates with unresponsive loads and specifies that the user cannot change the behaviour of the appliance without employment of additional technologies, such as refrigerator and freezer loads [95]. In the smart electricity grid, users are able to produce power (in-home energy) from distributive generation units. The home energy management (HEM) system in the smart grid empowers demand response (DR) and demand-side management (DSM) programs. DR assists in management and alteration of electricity usage responding to electricity supply while DSM emphasizes planning, implementation, and evaluation of policies and techniques that reduce users' energy consumption and or costs. Various optimization schemes, protocols, and standards have been proposed for effective coordination of domestic appliances and distributed energy resources (DER) to attenuate the peak load and energy consumption expenses. This is an ongoing investigation across the world at academic, industrial and at government level.

Energy Management by Considering Pricing Scheme
Different pricing schemes have been used by the distribution companies in order to create an efficient energy management scheme. The pricing schemes proposed so far are real-time pricing, time of use pricing, critical peak pricing, day ahead pricing. In real-time pricing, the consumer is notified about the charges on an hourly basis. In time of use pricing, the consumer is charged more during peak periods, less during mid-peak, and least during off-peak. An energy management that links fee structure and scheduling of appliances operation can be used to minimize cost of energy. One example is the in-home energy management (iHEM) [96]. iHEM utilizes smart appliances, a central energy management unit (EMU), and wireless sensor networks for communication between the appliances, EMU, and smart smart meters. The EMU communicates with a smart meter to inquire about the updated charges. Occupants' requirements are processed in near real-time, then iHEM suggest a convenient start time to the consumer. The consumer at this phase may be willing to negotiate with EMU. The decision support tool (DsT) proposed in [97] has the main intention to assist users make smart decisions during their appliances operation. In the absence of energy management programs, 30% of the load occurs in the course of peak hours. By employing iHEM, the peak load can be decreased to 5% [98]. iHEM also attenuates carbon emission and energy consumption expenses. In order to take advantage from the time of use pricing and reduce energy expense, appliance coordination have been proposed in [99] with the objective of shifting the consumer load to off-peak periods. The work indicates that the consumer's cooperation in the energy management program improves the efficiency of the method.
Benefits of an energy management program may be increased if distributed energy resources (DER) coordination is adopted in parallel with the appliance coordination [100]. In [97], the concept of the DER coordination has been assessed. The net benefit of the consumer is maximized by scheduling the controllable DER conforming the scheduling algorithm. The consumer's energy bill is decreased by 16%-25% [97].

Energy Management by Considering Household Occupancy
Occupant behaviour has an extensive impact on energy consumption and building controls. Unaware energy consumption can add one-third to a building's designed energy performance [101]. Former research has demonstrated that utilization of real-time occupancy information for controlling the lighting can save a remarkable amount of the electrical energy used for lighting [102]. Recent investigation is concentrated on the development of energy intelligent buildings that incorporates residents' activities and behaviour as a significant element for energy management systems. A home automation system should be able to recognize whether or not a house is occupied [103]. In addition, many home automation systems also require forecasting when a house is going to be occupied. When a home is not occupied, the automation system will turn off or dim all the artificial lighting, reducing ventilation rate, and setback the heating setpoint. Upon predicted occupancy, the system can trigger heating in advance to heat the house back to the normal setpoint prior to occupancy [103]. A smart heating system should tackle two primary requirements: Reducing energy consumption while maintaining the comfort of occupants. The smartness of the system typically depends on its ability of adaption to prevalent environmental circumstances, the household specifications, and the behaviour of the residents. Utilizing information and communication technology to automatically and intelligently control heating systems has been investigated for years. Smart space conditioning devices, such as the Neurothermostat [104], the GPS Thermostat [105], the Smart Thermostat [106], NEST learning thermostat, and Eco Bee's Smart-Si [107], and several others [53,[108][109][110][111][112], have been appeared.

Building Energy System Modelling
Building energy systems (BES) support the operations within a house, such as space heating, data transmitting, and operating appliances. BES regulates the energy consumption of the buildings by employing physical equipment or machinery, or even exerting a procedure that contains an integration [113]. In order to manage, predict, and optimize the operations of these systems and houses, numerical models have been created to simulate the energy consumption. Regardless of various structures that are proposed as models that simulate the buildings energy system, an energy system model contains three modules including input parameters, output parameters, and the system itself [114], this is demonstrated in Figure 3. As Fig.3 indicates, the input variables known as regressor or forcing variables operate within the building's energy system. For instance, a thermostat set point is considered as a controllable input variable. In contrast, solar radiation, outdoor air temperature, and wind speed are acknowledged as variables with uncontrollable variables, these can only be predicted by suitable techniques. For an energy system within a building, room air space temperature and humidity are regarded as output variables that explain the response of the building's energy system to input variables. Output variables of a BES model in certain occasions can be the net energy consumption or the energy utilization itself [115]. A BES modelling architecture is mainly categorized as: Forward approach and data-driven approach [115]- [117].
A BES model can be developed utilizing a forward procedure. This comprises the forecast of output variables from a comprehensive architecture and parameter of the model conformed to a set of input variables. Models that are developed with execution of this approach are recognized as white-box models; these are extremely precise since the energy transmission procedures are mapped into the development of the BES modelling structure. Augmented trends of integrity in computing schemes enabled the development of precise BES models which indicates the fact that BES does not rely on constructive development and preserves time and energy. Forward modelling of BES is carried out within the preliminary design and analysis phase.
Data driven approaches, which can be further categorized into grey-and black-box models, empower development of BES model by comprehending both input and output data. This type data is either already known or attained within performed evaluations throughout experimental procedures. In this scheme, the BES model is structured utilizing a single-variable or multi-variable regression analysis performed among quantified output variables of energy usage, occupancy, solar and wind data, etc. Regression models are either statistical or relies on primary engineering formulation of energy consumption in buildings. Long-term simulations require time-consuming and prohibitive arrangements to capture the variables within the simulation duration. In this case artificial learning methods such as Artificial Neural Networks (ANN) and Fourier series are employed to estimate the parameters of the underlying model. However, in most cases the identified BES model parameters indicate minor physical significances which decrements the amount of data to be measured using the artificial learning or searching techniques that preserves significant amount of time and memory. Moreover, BES model parameters are evaluated based on genuine performance data and data driven models happen to be precise considering the computational intelligence and power.

Energy modeling system
Controllable variables

affect energy system
Uncontrollable variables

affect energy system
Output variables describe energy system response to input variables As Figure 3 indicates, the input variables known as regressor or forcing variables operate within the building's energy system. For instance, a thermostat set point is considered as a controllable input variable. In contrast, solar radiation, outdoor air temperature, and wind speed are acknowledged as variables with uncontrollable variables, these can only be predicted by suitable techniques. For an energy system within a building, room air space temperature and humidity are regarded as output variables that explain the response of the building's energy system to input variables. Output variables of a BES model in certain occasions can be the net energy consumption or the energy utilization itself [115]. A BES modelling architecture is mainly categorized as: Forward approach and data-driven approach [115][116][117].
A BES model can be developed utilizing a forward procedure. This comprises the forecast of output variables from a comprehensive architecture and parameter of the model conformed to a set of input variables. Models that are developed with execution of this approach are recognized as white-box models; these are extremely precise since the energy transmission procedures are mapped into the development of the BES modelling structure. Augmented trends of integrity in computing schemes enabled the development of precise BES models which indicates the fact that BES does not rely on constructive development and preserves time and energy. Forward modelling of BES is carried out within the preliminary design and analysis phase.
Data driven approaches, which can be further categorized into grey-and black-box models, empower development of BES model by comprehending both input and output data. This type data is either already known or attained within performed evaluations throughout experimental procedures. In this scheme, the BES model is structured utilizing a single-variable or multi-variable regression analysis performed among quantified output variables of energy usage, occupancy, solar and wind data, etc. Regression models are either statistical or relies on primary engineering formulation of energy consumption in buildings. Long-term simulations require time-consuming and prohibitive arrangements to capture the variables within the simulation duration. In this case artificial learning methods such as Artificial Neural Networks (ANN) and Fourier series are employed to estimate the parameters of the underlying model. However, in most cases the identified BES model parameters indicate minor physical significances which decrements the amount of data to be measured using the artificial learning or searching techniques that preserves significant amount of time and memory. Moreover, BES model parameters are evaluated based on genuine performance data and data driven models happen to be precise considering the computational intelligence and power.
To formulate a physical model to demonstrate the architecture, the physical arrangement of the building, or HVAC&R equipment or system, a grey box scheme is utilized. This scheme recognizes significant parameters and accumulates physical parameters and specifications through statistical analysis [116]. The aforementioned approach acquires expertise user contribution within the configuration of proper modelling equations and estimation of parameters. Although intrusive experimental protocol is essential for convenient parameter assessment, this scheme enables fault detection and diagnosis (FDD) and online control which is applicable on the energy utilization of the whole building. Instances of parameter estimation investigation toward building's energy consumption are studied in [116,[118][119][120][121][122][123][124][125][126][127][128][129].

Future Perspective on Smart Homes
This section aims to look at future smart homes and the services that smart homes would provide for residents to guarantee their comfort and safety. To investigate the connection of smart homes to other smart environments, vehicle-to-home (V2H) connectivity and the home-based healthcare network concept are used as samples.
A connected car is a vehicle in which the driver and passengers would be able to access, use, and share information within vehicular communications systems, such as vehicle-to-vehicle (V2V) or vehicle-to-infrastructure (V2I) communications [130]. Connected car service industries have been gradually increasing in size and number, and they are extending their services to incorporate home connectivity [131]. Integration of vehicles and smart home functionalities would enable drivers to control lighting, appliances, heating, entertainment systems, or garage doors before arriving home [132,133]. Quddus et al. [134] proposed a map-matching algorithm for navigation, and Duri et al. [135] developed an in-vehicle data framework that ensures security and privacy of drivers. Godoy et al. [136] improved the performance of telematics through a system based on the Zigbee suite of communication protocols. Moreover, Resin et al. [137] proposed a future wireless technology to connect a vehicle with a home. Recently the concept of V2H connectivity has been addressed in optimization of energy expenses using plug-in hybrid electric vehicles (PHEV). Using PHEV as backup generator [138], electricity generation sharing [139] and electricity storage [140] have been studied.
As the demographic is changing, all aspects of our society will be affected. The aging population is one of the major alterations that causes a significant impact since estimations indicates that the global median age will be 36.8 by 2050 [141]. Additionally, according to the World Health Organization, almost 10% of the population experience some form of disability. As a result of these demographic alterations, there is a huge demand for health and social care services.
Home healthcare services main intention were transmission of patients' health status to devoted data centres, particularly for circumstances like elderly dependency or social isolation. Technology development and increment of health expenses has resulted in decentralization of healthcare from the hospital to the home. Healthcare can be obtained more efficiently in the home in comparison with hospitals. The 'smart home' equipped with appropriate sensors can serve as a centre component of the healthcare service system [142][143][144]. The smart home can provide tele-consultation, virtual visits, and monitoring [145,146]. There is a strong belief that the user-centred, home-based systems will be appointed as the foundation of healthcare in the future.
Operating devices that monitor health and activity or provide assistance in the home must be non-obtrusive and accepted by users. Moreover, privacy and confidentiality require to be considered while the moral and legal matters of 'monitored' living requires to be settled in order to enhance admissibility before the technology is widely promoted.
The Gator Tech Smart House in Gainesville, Florida, is the result of more than five years of investigations on the application of pervasive and mobile computing in-home-based healthcare services [147]. The goal of the project is providing assistive habitat that is able to sense not only itself but also its residents. This house could be the good example of smart homes in future.

Summary and Conclusions
Smart homes are provisioned with technology that monitors the residents and supplies proactive services. The primary objectives of smart home systems are providing convenience, augmenting security, and preserving energy.
All smart homes emphasize energy management and comfort and safety of their inhabitants. To achieve these goals, the smart home needs to be conscious of its environment. Monitoring the environment is strongly dependent on underlying sensor technologies. Furthermore, a smart home must scrutinize the sensor generated data to make decisions and required changes within the environment. This clearly demonstrates the importance of activity recognition and prediction medium in the smart home concept.
Energy performance of smart homes requires consideration of building properties, in addition to behaviour of their occupants and state of the environment. To analyze the dynamic thermal behaviour of buildings, a suitable model needs to be selected. The grey box modelling appears to provide the most effective scheme for energy consumption management of buildings.
There are two focused areas defined for smart homes: Users and buildings. These two areas have a strong connection with each other in energy management and inhabitants' comfort. Most energy management schemes presented in the literature rely on scheduling and shifting consumption from peak-load time to low-load time. However, to attain effective energy management, it is necessary to integrate the occupant activity and behaviour as a critical element to construct energy and comfort management (BECM) systems. In addition to occupant detection, it is necessary to predict the occupants' state to avoid loss of comfort; this poses a challenge for future research and development in the area of smart homes. Another challenge is future convergence of multiple existing IoT services to create new ones, for example car-home connectivity and home-based healthcare.
In conclusion, it is expected that smart homes will become more and more important in the near future. This will intensify the demand for effective energy management considering the occupants' comfort. Several other challenges still need to be addressed in the context of smart homes, such as deploying efficient sensor technologies, activity recognition and prediction, methods for data storage and analysis. In addition, future smart homes will co-exist with other smart technologies and require convergence of corresponding networks and services. This clearly illustrates the multidisciplinary nature of this area and requires the involvement of number of specialists in developing future smart homes.