## 2 Literature Review
### IoT for Home Energy Management  
IoT-based HEMSs empower homeowners with precise control over energy consumption, fostering smarter and more responsive home environments. This subsection examines current IoT technologies for energy monitoring and device control, highlighting different architectures and approaches in processing, usability, and scalability. [PERSON] et al. [13] and [PERSON] et al. [14] introduce IoT-based HEMSs that leverage Big Data collection and analytics. Both collect data from a network of ambient and energy consumption sensors to a centralized server. [PERSON] et al. 's system uses the shelf Business Intelligence software (Hitachi Vantara V2016) for visualization and energy use monitoring, while [PERSON] et al. utilizes the J48 classification Machine Learning (ML) algorithm for analyzing consumption and user behaviors to optimize energy efficiency and comfort. In the second case, real-time visualization comes via a mobile app. [PERSON] et al. [15] propose a Big Data and IoT-driven Energy Management System (EMS) for residential areas that utilizes distributed processing to monitor, visualize, and analyze large-scale energy consumption data for optimizing household and community-level energy use. These approaches enable data-driven insights and predictive analytics but they face challenges with scalability, latency, and security vulnerabilities due to volume, as well as the centralized collection of generated data and high computational demands [16]. [PERSON] et al. [17] raise another important question in the context of IoT for HEMSs, which is the connectivity and interoperability of smart home devices. The authors propose a smartFW framework to address the challenges associated with integrating various commonly used communication protocols such as Zigbee, EnOcean, KNX, X10, and Z-Wave. The challenges that arise from Big Data approaches are partially mitigated with the adoption of cloud-based processing. [PERSON] et al. [18] and P. & S. [19] introduce Cloud-IoT-based HEMSs that use layered architectures for real-time energy monitoring and appliance or socket control. Beyond the sensor network, the communication layer uses the lightweight MQTT protocol while data storage, APIs (middleware layer), analytics, visualization, and user interaction (application layer) are delegated to cloud services. These approaches initially scale easily but can be costly as the number of installations and computational intensity grows. Latency issues and the demand for reliable connection can hinder the real-time aspect of these approaches. Finally, storing sensitive energy consumption data in the cloud raises concerns about data security and user privacy. The introduction of edge computing with IoT-driven HEMSs utilizes local data processing to enhance real-time decision-making, reduce latency, and improve security. [PERSON] et al. [20] propose a low-cost, edge-computing middleware for HEMSs, utilizing microservices to enhance scalability and minimize latency. The middleware is designed with a hybrid approach where basic data collection, processing, and control tasks are handled locally at the edge, while more complex analyses are offloaded to the cloud. [PERSON] et al. [12] propose a resilient, edge-based demand response (DR) optimization system for Smart Energy Systems that uses a local cloud architecture and ML to improve energy efficiency and ensure user comfort. The introduction of additional local cloud nodes allows this scheme to scale to large facilities while keeping data processing local to each node. [PERSON] et al. [21] presents an edge-computing-based system that integrates IoT devices with a blockchain to create a secure and decentralized framework for real-time monitoring and prediction of energy usage, using ARIMA for forecasting and smart contracts to facilitate automated transactions for energy trading and DR.