The communication layer helps home residents control smart home devices, both intelligently and efficiently. The goal in this layer is to collect information from the different  IoT-based devices installed in a smart home. These data provide information on the home, such as energy consumption, room temperature, motion, and the air conditioner’s temperature, to name but a few. 

sensors are a key element in smart home monitoring. By collecting real-time information,  sensors allow  HEMS-IoT to analyze and identify how much power smart home appliances and devices are consuming. Users can visualize and monitor this information on a daily basis to make the necessary energy-saving adjustments. Also, thanks to sensors, HEMS-IoT can issue appropriate energy-saving recommendations and invoke both basic services (e.g.,  plumbing and electrical repairs) and emergency services (e.g., police, firefighters) when required.


Management Layer  

This layer uses machine learning and big data storage technologies to easily manage and analyze the information collected in the device layer. Similarly, information access commands are encapsulated by the management layer to ensure information security. The management layer also identifies user behavior patterns and classifies homes according to their energy consumption patterns using the API of Weka 3.8, which is the stable version of the open-source software and successfully helps HEMS-IoT comply with the required functionalities. To classify data and generate energy-saving recommendations, HEMS-IoT uses an open-source Java implementation of algorithm C4.5, which is the J48 machine learning algorithm. C4.5 and J48 are used to generate decision trees, and they are classification algorithms. Classification algorithms are widely used in healthcare and have proved to yield outstanding results in the diagnosis of hepatitis, cancer, heart disease, eye diseases, and tumors on digital mammograms. In addition, J48 has a better performance than other algorithms, such as random forest, CART, random tree, fuzzy C-means, and REPTree. 


HEMS-IoT was developed and implemented in a modular and generic way, with better application extensibility, ease of implementation, and with a view to high performance. The tasks performed by the management layer can be divided into four groups: 

  • User management. Comprises actions such as deleting and editing user-profiles and user registration, among others. 
  • Home management. Encompasses actions of knowledge deletion, data editing, and management of domotic devices, among others. To this end, we used a subversion of the online ontology language (OWL), the OWL-DL, which is predicated on the SHI2 description logic. Likewise, OWL-DL has a broad vocabulary and greater expressiveness than RDFS. depicts a fragment of the developed ontology, which presents the main domotic concepts, such as home activity, environment, entity, and stay, among others. We also followed the Methontology method to develop the house automation ontology.
  • Recommender system.This system issues recommendation for energy-saving and home comfort based on home residents’ behavioral patterns. To this end, the system takes into account both daily and average energy consumption values from each domotic device, which allows the system to generate the rules in the algorithm. Therefore, smart homes are classified on a daily basis with respect to four energy consumption categories: normal, low, medium, and high.

IoT Services Layer

This layer provides various REST-based web services to communicate with both the application layer and the management layer. Therefore, HEMS-IoT clients can without much of a stretch interface with the framework's functionalities. The main components in this layer are described below: 

  • REST API. REST collects information or performs operations on such information in all possible formats, such as JSON and XML, using HTTP. REST is a good option if compared to other protocols for information exchange, such as the Simple Object Access Protocol (SOAP), which has a high capacity but is a complicated Smart Home System for Energy Saving.
  • Service selector. This module validates the parameters passed on by the presentation layer and choosing the required services. Likewise, the service selector has the power to either give or deny services, according to the authentication data and received parameters


Security Layer

This layer guarantees data confidentiality and can retrieve data protected by both the device layer and the end-users. The communication layer and the administration layer facilitate communication between the security layer and the device layer. This layer considers two security components, authorization, and authentication, described below: 

  • Authentication. This refers to the act of validating with evidence that something/someone is what/who they claim to be. Object/device authentication involves ensuring its origin, whereas confirming user identity usually implies user authentication. In HEMS-IoT, user authentication requires ensuring that the user who wishes to interact with the system is truly who he/she claims to be. When this is the case, HEMS-IoT authorizes said user to access the Smart Home System for Energy Saving.
  • Authorization. This occurs after user identity is authenticated by the system. The goal of authorization mechanisms is to protect user information and prevent unauthorized or unidentified users from accessing data or performing particular tasks. Authorization and authentication are different since authorization involves the tasks that users are allowed to perform or the information that can access once their identity is confirmed. User authorization is applied either to individual elements or to a set of them. In smart home management systems, each element relates to an activity to be run.


Presentation Layer

As a mobile application, HEMS-IoT works on the Android operating system. Figure 4a illustrates the application’s menu list on the presentation layer. The main menu options include home (i.e., return to the initial screen), favorites (rapidly access preferred rooms), statistics (visualize energy consumption patterns), rooms (view homerooms), and devices (visualize domotic devices and sensors connected to the smart home). Additionally, the application’s menu allows users to add and remove devices or rooms, view existing user profiles, consult and change application settings, and exit the application. illustrates samples of comfort, safety, and energy-saving recommendations issued by HEMS-IoT.