{'fraction_non_alphanumeric': 0.02695100006205142, 'fraction_numerical': 0.005977620121207107, 'mean_word_length': 5.345714660716629, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Survey on Energy Efficiency in Smart Homes and Smart Grids

Empowered by the emergence of novel information and communication technologies (ICTs) such as sensors and high-performance digital communication systems, Europe has adapted its electricity distribution network into a modern infrastructure known as a smart grid (SG). The benefits of this new infrastructure include precise and real-time capacity for measuring and monitoring the different energy-relevant parameters on the various points of the grid and for the remote operation and optimization of distribution. Furthermore, a new user profile is derived from this novel infrastructure, known as a prosumer (a user that can produce and consume energy to/from the grid), who can benefit from the features derived from applying advanced analytics and semantic technologies in the rich amount of big data generated by the different subsystems. However, this novel, highly interconnected infrastructure also presents some significant drawbacks, like those related to information security (IS). We provide a systematic literature survey of the ICT-empowered environments that comprise SGs and homes, and the application of modern artificial intelligence (AI) related technologies with sensor fusion systems and actuators, ensuring energy efficiency in such systems. Furthermore, we outline the current challenges and outlook for this field. These address new developments on microgrids, and data-driven energy efficiency that leads to better knowledge representation and decision-making for smart homes and SGs.


Introduction
Smart grids (SGs) are comprised of advanced and complex technological components [1], both physical and logical. Their popularization and development are growing across the globe [2,3], given the multiple benefits this kind of infrastructure provides over the former electricity distribution network [4]. Some of them include: • a safer and more resilient electricity distribution network, • self-healing protection mechanisms, • advanced monitoring capabilities and load management, • a cost reduction in network operations due to the dynamic balancing between production and demand, • a cleaner, decentralized production of electricity, • a reduction of the traditional costly peak production capacity, • bidirectional flow of electricity.

•
The architecture level, where it is necessary to consider problems as credentials distribution to enable end-to-end security between devices and applications. It also features dynamic fine-grain authorization management to control which application is entitled to use which data. • Smart devices compose the hardware part of the grid. They can be hardened via secure elements in the devices [13]. Also, a challenge is defining low-cost, highly scalable secure element solutions, including hardware, provisioning, and deployment components, to use certain secure embedded elements well suited to SG applications. • Software applications to manage the SG components.
It is essential to ensure that the data collected within the grid is stored and distributed securely and only to authorized parties. It is also crucial to ensure that the devices, sensors, and actuators deployed within the grid are trusted and cannot be easily cloned and replaced by malicious ones. The security of the grid is therefore of extreme importance. It will involve the definition of advanced security architectures well suited to SG and the definition of a new generation of standardized, secure element solutions compatible in cost and ease of deployment with SG's business models.
As shown in Figure 1, the use of the SG starts at the first link of the value chain: the energy production; the power plants make the production data available through the grid. Its use continues with the transportation chain, where the different meters inform about the energy circulating through the transportation means. The distribution units also submit the data about their performance via the grid. Customers make intensive use of the SG since they use and produce data transmitted through the grid. Remarkably, the interaction with customers occurs through smart homes, which are ICT-empowered homes that assist their residents with energy consumption. Finally, outsourcing companies or other business units of the energy companies may interact with the grid by retrieving or transmitting any data.
In conclusion, all the links of the energy value chain use the SG, so any energy market actors are subject to attacks. In this regard, several recent studies propose technologies such as blockchain [14][15][16] to mitigate problems such as centralization of the management system, support the operation of crowdsourced energy systems, remove single points of failure, and prevent fraud and the ability to forge energy transactions. However, these technologies are mainly applied theoretically or in testing environments to SGs.
In this paper, we contribute with an overview of the state-of-the-art developments comprising the area of energy-efficient SGs and smart homes. We cover the whole domain relevant for ICT use, starting from the physical infrastructure and proceeding towards the end-users of smart homes and grids. Also, relevant topics related to the solutions such as decentralization, security, and blockchain applications are discussed. This state-of-the-art survey is concluded by the outlook and future work areas derived based on the reviewed literature and projects. The rest of the article is organized as follows. Section 2 outlines the followed methodology for this survey. Section 3 presents relevant technical solutions to achieve energy efficiency within smart homes and grids. Section 4 gives an outlook and outlines future lines of work. Section 5 contains conclusions.

Survey Methodology
To create this paper, a typical survey methodology has been followed; namely, we have been following a method for systematic literature review [17]. The peer-reviewed publications as the primary resource have been identified using the typical for ICT literature scholarly indexing services: Google Scholar, IEEE Xplore, the ACM Digital Library, Scopus, and DBLP. We considered a representative number of studies primarily ranging from 2016 to 2021, focusing on the most recent and relevant ones. The query terms included relevant keywords for both addressed domain and specific technology, such as energy efficiency, smart home, semantic technology, ontology, knowledge graphs, big data, security, fraud, detection, encryption, SG, communication, and behavioral change. Authors and affiliations of the publications were also used as keywords to find additional relevant sources of knowledge, and the authors' many years of research experience and their knowledge of the covered field are relied on. Moreover, the citation count of the papers has been a relevant criterion to select and review them by. To provide a comprehensive investigation for ICT-enabled energy efficiency approaches, they are reviewed in separate sections dedicated to the SGs and to smart homes. In this paper, we contribute with an overview of the state-of-the-art developments comprising the area of energy-efficient SGs and smart homes. We cover the whole domain relevant for ICT use, starting from the physical infrastructure and proceeding towards the end-users of smart homes and grids. Also, relevant topics related to the solutions such as decentralization, security, and blockchain applications are discussed. This state-of-the-art survey is concluded by the outlook and future work areas derived based on the reviewed literature and projects.
The rest of the article is organized as follows. Section 2 outlines the followed methodology for this survey. Section 3 presents relevant technical solutions to achieve energy efficiency within smart homes and grids. Section 4 gives an outlook and outlines future lines of work. Section 5 contains conclusions.

Survey Methodology
To create this paper, a typical survey methodology has been followed; namely, we have been following a method for systematic literature review [17]. The peer-reviewed publications as the primary resource have been identified using the typical for ICT literature scholarly indexing services: Google Scholar, IEEE Xplore, the ACM Digital Library, Scopus, and DBLP. We considered a representative number of studies primarily ranging from 2016 to 2021, focusing on the most recent and relevant ones. The query terms included relevant keywords for both addressed domain and specific technology, such as energy efficiency, smart home, semantic technology, ontology, knowledge graphs, big data, security, fraud, detection, encryption, SG, communication, and behavioral change. Authors and affiliations of the publications were also used as keywords to find additional relevant sources of knowledge, and the authors' many years of research experience and their knowledge of the covered field are relied on. Moreover, the citation count of the papers has been a relevant criterion to select and review them by. To provide a comprehensive investigation for ICT-enabled energy efficiency approaches, they are reviewed in separate sections dedicated to the SGs and to smart homes.

Technical Solutions for Energy Efficiency with SGs and Homes
Big data is intended to put together all data coming from automated metering infrastructure (AMI). From the customer's perspective (electricity companies), revenue protection (in more straightforward language, theft detection) is a crucial application to secure their revenues. This has been the object of several works [6,[18][19][20][21][22]. Also, demand response analysis and management is an important task, getting customers to reduce their energy consumption, and hence, system peak loads. It can also focus on customer behavior (inducing privacyaware issues) [23] or the combination of messaging and incentives that are best at getting customers to reduce energy usage at the lowest possible cost to utilities. The outage management system (OMS) enhancements are the primary way to use AMI-gathered data to perform operational improvements from the network perspective. For instance, there are successful implementations of AMI-assisted outage restorations in post-disaster scenarios (weather events or cyber-attacks) [24][25][26]. These systems facilitate the ability to fix as-yet-unreported outages, like those that happen when the affected users may be asleep or away from home, and the health diagnoses of SG systems themselves [26].
Finally, utility regulators can use predictive analytics to create precise financial models to consider the costs and benefits of future deployments [27,28]. Accurate demand forecasting is crucial to perform efficient energy planning and trading. Predictions are even more impressive when applied to disaster prevention. Systems could accurately predict where thunderstorms may damage the SG [29] and allow utilities to stage specific crews and required equipment accordingly.
The SG allows users to automate their connection-disconnection of devices by enabling time-of-use pricing in the home automation field. However, it could also be shifted to the area of personal services. Users may want to include specific task automation rules to interact with their smart homes, e.g., "turn on the heating system 30 min before I arrive home". Here the smartphone, or maybe the car, which is not connected to the SG by default, is involved since it provides the user's location. Nevertheless, hackers can immediately manipulate their energy costs or forge fake energy meter readings by compromising a smart meter. Even more, in some cases, they can do the same with any other smart device connected to the grid [30]. Thus, in modern SG architectures, home automation is orchestrated through security channels and supervised by the network.
Securing communications in a system and a SG in particular always involves achieving both data protection and resilience to sabotage. Data protection requires the secure distribution of credentials used to harden data transmission and storage. It also needs an authorization management mechanism to define how devices and applications may interact together. Moreover, a second issue is involved since the data used to coordinate these rules is personal and must be deleted as long as it is not needed to automate the task. Novel approaches include using specific blockchain-based networks and smart contracts to address most of these issues [16,31,32]. Besides, the right security level usually involves protecting long-term credentials stored in the cloud platforms and the devices to prevent credential theft. Stolen credentials retrieved from an unprotected device may enable the cloning and impersonation of the device and open the way to destructive attacks. The concept of an efficient solution to protect credential storage on an insecure device is a real challenge. The use of secure embedded elements inside the devices constitutes a proven solution to enhance credential storage security [13]. Also, effective computational and storage cost solutions based on the blockchain can overcome the problems related to trusted control access by IoT-based smart meters in untrusted environments by decentralizing the trusted control access scheme and protecting the data transmission requests sent and received by smart meters to the network [14].
From another perspective, the availability of a large quantity of user-related data collected within the SG raises a privacy issue. Network intrusion prevention systems and network intrusion detection systems should enhance host-based defenses to protect the system from outside and inside attacks [33]. In this regard, solutions that combine blockchain-based energy exchange and deep learning networks that detect attacks and fraudulent transactions have been proposed [34]. Also, a particular use case consists of defining and elaborating the intelligent security monitoring and control layer that will Energies 2021, 14, 7273 5 of 16 monitor the bidirectional communication between supervisory control and data acquisition (SCADA) systems and remote devices. For operators of power plants and grids, it is of utmost importance to be aware. This raises the bar for new available commercial solutions. This is especially true for remotely located devices, which are installed in non-secure environments and require innovative security solutions. Simultaneously, these devices are typically connected to critical central systems, like SCADA, an element manager (for IT maintenance and support centrally), and a monitoring server (including the backup). This means that a complex communication environment requires better tunable security solutions for keeping the operators in a state of awareness. Some studies [35][36][37] propose a viable solution for SG in an intelligent security monitoring and control layer, adapted and enhanced with smart artificial intelligent anomaly detector systems (ADS). The intelligent monitoring and control systems actively follow the communication messages and compare these with the "learned" normal situation. So, it can detect anomalies that will trigger specifications (i.e., an alarm on the operator screen). A more context-based description, where in-depth monitoring and control are of vital importance, is provided in the following paragraphs.
In the energy production and distribution chain, ICT-based automation is increasingly involved, and this phenomenon will grow even more in the future by integrating information technologies (IT) and operational technologies (OT) into new operational information technologies (OIT) systems. Liberalization of the market and the rise of decentralized production add different communication interfaces between the other parties [38]. From a security perspective, all these various communication interfaces need to be monitored, and in case of anomalies, to adopt the appropriate mitigation actions. The typical communication structures in the energy production and distribution environment use SCADA systems as a hub [39]. The actual physical communication path ranges from copper and/or optic fiber to wireless solutions, meaning that third parties can provide the physical infrastructure. This fact induces extra incentives to monitor and control the communication mechanism carefully. Figure 2 shows a high-level representation using the Smart Grid Architecture Model (SGAM) reference model [40]. system from outside and inside attacks [33]. In this regard, solutions that combine block chain-based energy exchange and deep learning networks that detect attacks and fraudu lent transactions have been proposed [34]. Also, a particular use case consists of defining and elaborating the intelligent security monitoring and control layer that will monitor th bidirectional communication between supervisory control and data acquisition (SCADA systems and remote devices. For operators of power plants and grids, it is of utmost im portance to be aware. This raises the bar for new available commercial solutions. This i especially true for remotely located devices, which are installed in non-secure environ ments and require innovative security solutions. Simultaneously, these devices are typi cally connected to critical central systems, like SCADA, an element manager (for IT maintenance and support centrally), and a monitoring server (including the backup). Thi means that a complex communication environment requires better tunable security solu tions for keeping the operators in a state of awareness. Some studies [35][36][37] propose viable solution for SG in an intelligent security monitoring and control layer, adapted and enhanced with smart artificial intelligent anomaly detector systems (ADS). The intelligen monitoring and control systems actively follow the communication messages and com pare these with the "learned" normal situation. So, it can detect anomalies that will trigge specifications (i.e., an alarm on the operator screen). A more context-based description where in-depth monitoring and control are of vital importance, is provided in the follow ing paragraphs.
In the energy production and distribution chain, ICT-based automation is increas ingly involved, and this phenomenon will grow even more in the future by integrating information technologies (IT) and operational technologies (OT) into new operational in formation technologies (OIT) systems. Liberalization of the market and the rise of decen tralized production add different communication interfaces between the other partie [38]. From a security perspective, all these various communication interfaces need to b monitored, and in case of anomalies, to adopt the appropriate mitigation actions. The typ ical communication structures in the energy production and distribution environment us SCADA systems as a hub [39]. The actual physical communication path ranges from cop per and/or optic fiber to wireless solutions, meaning that third parties can provide th physical infrastructure. This fact induces extra incentives to monitor and control the com munication mechanism carefully. Figure 2 shows a high-level representation using th Smart Grid Architecture Model (SGAM) reference model [40].  (i.e., intelligent electronic devices-IEDs) have not included security mechanisms in their devices; thus, security by design is not always implemented. In installed systems, some unprotected devices can still be found. This requires stringent security procedures for technical, operational people (both vendors employees) when updating, commissioning, or configuring these remote devices. However, the bidirectional monitoring and control of the communication between these remote devices and the centralized SCADA systems are vital to keeping the energy systems up and running. Figures 3 and 4 show the smart grid according to SGAM zones.
In the future, SG will evolve in an even more intelligent environment where the remote devices in substations will communicate with each other. An example is the self-healing ring concept that makes it possible that the network itself will heal after a malfunction in the medium voltage meshed or ring networks (e.g., a cable cut). This brings extra challenges for the security application because the IEDs will communicate directly without consulting the SCADA. After restoration, the SCADA system needs to be informed of the new medium-voltage network status [41]. In this case, an AI-based approach needs to follow up on the monitoring and control messages between the IEDs and the SCADA system. The future SG needs updates in the environment of station level, typically in the layer where the aggregation devices are found that communicate to the SCADA systems. Special attention is paid to security architecture [42]. As shown in the example below, the demilitarized zone (DMZ) needs to be defined, the communication messages that flow to and from the different devices and to and from the SCADA system must be identified, described, and, in the end, this information and the intelligence on how to act after an anomaly detection has to be programmed in ADS. This also means that these enhanced ADSs need to be adapted, tested and implemented.
The general build-up of the primary layers that interface to monitor and control a power plant or grid is shown. Most of the applied ICT automated device vendors (i.e., intelligent electronic devices-IEDs) have not included security mechanisms in their devices; thus, security by design is not always implemented. In installed systems, some unprotected devices can still be found. This requires stringent security procedures for technical, operational people (both vendors employees) when updating, commissioning, or configuring these remote devices. However, the bidirectional monitoring and control of the communication between these remote devices and the centralized SCADA systems are vital to keeping the energy systems up and running. Figures 3 and 4 show the smart grid according to SGAM zones.
In the future, SG will evolve in an even more intelligent environment where the remote devices in substations will communicate with each other. An example is the selfhealing ring concept that makes it possible that the network itself will heal after a malfunction in the medium voltage meshed or ring networks (e.g., a cable cut). This brings extra challenges for the security application because the IEDs will communicate directly without consulting the SCADA. After restoration, the SCADA system needs to be informed of the new medium-voltage network status [41]. In this case, an AI-based approach needs to follow up on the monitoring and control messages between the IEDs and the SCADA system. The future SG needs updates in the environment of station level, typically in the layer where the aggregation devices are found that communicate to the SCADA systems. Special attention is paid to security architecture [42]. As shown in the example below, the demilitarized zone (DMZ) needs to be defined, the communication messages that flow to and from the different devices and to and from the SCADA system must be identified, described, and, in the end, this information and the intelligence on how to act after an anomaly detection has to be programmed in ADS. This also means that these enhanced ADSs need to be adapted, tested and implemented.

Smart Homes
Smart homes are technically equipped dwellings that can monitor and improve their energy consumption among several other tailored services for users [43]. Extending this idea to buildings, we also have the term "smart buildings". Smart buildings are energyefficient, technically integrated, safe and sustainable buildings that are part of broader energy grids. Technologies that involve heterogeneous approaches and frameworks include the internet of things (IoT), integration and interoperability solutions, energy consumption awareness, energy consumption prediction, and decentralized deployment.
IoT developments become relevant in addressing the challenge to lower the impact of humanity on the environment. One of the techniques that is already in use is home automation [44,45]. The smart meters installed in buildings, together with sensors and actuators, keep track of and even optimize energy consumption. Smart meters are technical devices that automatically measure the energy consumption of a building unit. In the European Directive for Energy Buildings [46], at least 80% of energy consumers should be equipped with smart meter systems by 2020.
The goal of the usage of smart meters is the ability to offer accurate and frequent billing details. AI technologies might enhance smart meters in the future so that they can manage and improve the energy consumption levels autonomously [47].
Smart cities are comprised of interconnecting homes, offices, data centers, warehouses, and public infrastructure. European cities are actively working on ideas and prototypes to accomplish the vision of smart cities. An example is the city of Innsbruck, where the notion of a holistic energy identity in 2050 is only possible by an overall consideration of the city as a system in which energy, buildings, supply networks, mobility, information, and people are viewed in an integrated manner [48].
For the integration of information in smart homes, semantic technology increasingly serves as an enabler for semantic interoperability for smart homes. An example of such development is the SESAME project that offers a plug-and-play solution for integrating

Smart Homes
Smart homes are technically equipped dwellings that can monitor and improve their energy consumption among several other tailored services for users [43]. Extending this idea to buildings, we also have the term "smart buildings". Smart buildings are energyefficient, technically integrated, safe and sustainable buildings that are part of broader energy grids. Technologies that involve heterogeneous approaches and frameworks include the internet of things (IoT), integration and interoperability solutions, energy consumption awareness, energy consumption prediction, and decentralized deployment.
IoT developments become relevant in addressing the challenge to lower the impact of humanity on the environment. One of the techniques that is already in use is home automation [44,45]. The smart meters installed in buildings, together with sensors and actuators, keep track of and even optimize energy consumption. Smart meters are technical devices that automatically measure the energy consumption of a building unit. In the European Directive for Energy Buildings [46], at least 80% of energy consumers should be equipped with smart meter systems by 2020.
The goal of the usage of smart meters is the ability to offer accurate and frequent billing details. AI technologies might enhance smart meters in the future so that they can manage and improve the energy consumption levels autonomously [47].
Smart cities are comprised of interconnecting homes, offices, data centers, warehouses, and public infrastructure. European cities are actively working on ideas and prototypes to accomplish the vision of smart cities. An example is the city of Innsbruck, where the notion of a holistic energy identity in 2050 is only possible by an overall consideration of the city as a system in which energy, buildings, supply networks, mobility, information, and people are viewed in an integrated manner [48].
For the integration of information in smart homes, semantic technology increasingly serves as an enabler for semantic interoperability for smart homes. An example of such development is the SESAME project that offers a plug-and-play solution for integrating building automation systems with advanced metering systems to facilitate an energy-aware home automation system [49]. The project uses semantic rules to describe how appliances within the environment will be operated. These rules enable reasoning on the measured data. For the SESAME project, three ontologies were developed [50]:

•
The Automation Ontology includes general concepts such as Resident and Location, but also ideas in the automation and the energy domain, such as device (with consumption per hour, peak power, on/off status), and Configuration (configuration data of an appliance), • The Meter Data Ontology enables communication protocols for data exchange with the metering equipment, • The Pricing Ontology is used for selecting the optimal tariff model for a specified time and energy load. It defines weighted criteria, which are then used by the reasoning engine for choosing the best tariff model.
Involvement of the end users and engaging them as active prosumers creates challenges in building systems that implement energy consumption awareness. As an example of an energy awareness approach, the Entropy project [51] aims to sensitize tenants to their dwellings' consumed energy [52]. These dwellings are equipped with special sensors that collect energy consumption data. The tenants are kept informed by a specially developed application about their energy consumption. The Entropy project focuses mainly on the tenants' behavior and suggested lifestyle changes to reduce the energy consumption via their services, but in a user-friendly manner.
As described in [52], the entropy services collect and process data from sensor nodes in real-time and manage historical sensor data. The Entropy project uses semantic web technologies like semantic models and ontologies for unified data representation of the previously collected sensor data. The two developed semantic models are the energy efficiency semantic model, which represents the energy consumption data collected from the sensors, and, the behavioural semantic model, which focuses on the energy consumption profile of end users.
These models facilitate the further management and exploitation of the collected sensor data. With LinDa workbenches [53], the semantically annotated data from the semantic models are transformed into linked data. This approach is of use to the building sector because comparisons between the collected data and the exchange with other open linked data like meteorological data are needed. The data is stored in the JSON-LD [54] data format, a lightweight linked data format. The recommender system behind Entropy is based on the Drools framework [55], which is a rule-based management system. In the Entropy project, a rule is expressed by a condition element and a recommendation template. Entropy's recommender system uses machine learning techniques and provides the user with personalized suggestions taking into account the user attributes and behavioral traits [55]. For example, if a context changes, the recommender system creates personalized recommendations for each user in the targeted user group using the recommendation template. The targeted user group is based on users that satisfy specific user attributes defined in the template. Through the Entropy project an application was developed that joins energy and behavioural data and, as a consequence, leads to the improvement of energy efficiency in smart buildings [51].
Energy consumption prediction in smart homes and grids is another important aspect that involves AI. Building thermodynamics is a complex non-linear phenomenon, which is strongly influenced by weather conditions, building operating modes, and occupant schedules and requires, for example, predictive data-driven models [56]. These models were developed with the help of machine learning techniques. The machine learning algorithms are trained with a set of data and run on a different set, applying what they learned during the training period. The developed predictive models are of two categories. On one side is the black-box, in contrast to white-box model models (e.g., support vector regression, regression forest), and on the other side is the grey-box models (e.g., Gaussian). This research proved that the predictions generated by the black-box models applied to Gaussian). This research proved that the predictions generated by the black-box models applied to temperature values outperformed the grey-box models used for energy consumption values because the first captured human behavior. Human behavior has a more significant impact on energy consumption than the envelope of the building. According to the researchers, the random forest had the best prediction results [56].
From the standpoint of security and decentralisation, it is a challenge to monitor in real-time the SG and all the devices connected to it. ICTs are crucial for the success and implementation of the SG concept. Several communication technologies could support SG communication in the distribution system, ranging from optical fiber to power line carrier (PLC) to wireless technologies.
A three-level hierarchy can be defined to support an SG communications network. It includes the home area network (HAN), neighborhood area network (NAN), and wide area network (WAN). An overview of the AMI communication scheme is shown in Figure  5. With ICT-enhanced infrastructures, grids are evolving from centralized and hierarchical topologies to distributed and holonic architectures. They provide substantial added value in terms of efficiency, eco-friendliness, and savings. However, a significant impediment to their adoption is the security issues they raise. With enhanced communication, load balancing automation, and important heterogeneous data analysis capabilities, the grid becomes vulnerable to large-scale cyber-attacks [9,10]. Hence, security is to be a "market enabler" to smart grids. An identified method of attacking the meters involves placing a strong magnet on the devices, which causes them to stop measuring usage while still providing electricity to the customer [57]. Some customers are using this method to disable the meter at night when air-conditioning units are operational. This is an example of a physical attack related to significant concern in the power systems planning and operation, which is commercial losses (also known as non-technical losses). This type of loss has consequences from the grid operational point of view, as it causes unexpected loads in system elements, as well as from the economic point of view. Some works on non-technical losses' minimization and identification have been developed [58][59][60], but this is still an area to be improved. At the same time, new data becomes available and suitable to be analyzed utilizing AI-based techniques. With ICT-enhanced infrastructures, grids are evolving from centralized and hierarchical topologies to distributed and holonic architectures. They provide substantial added value in terms of efficiency, eco-friendliness, and savings. However, a significant impediment to their adoption is the security issues they raise. With enhanced communication, load balancing automation, and important heterogeneous data analysis capabilities, the grid becomes vulnerable to large-scale cyber-attacks [9,10]. Hence, security is to be a "market enabler" to smart grids. An identified method of attacking the meters involves placing a strong magnet on the devices, which causes them to stop measuring usage while still providing electricity to the customer [57]. Some customers are using this method to disable the meter at night when air-conditioning units are operational. This is an example of a physical attack related to significant concern in the power systems planning and operation, which is commercial losses (also known as non-technical losses). This type of loss has consequences from the grid operational point of view, as it causes unexpected loads in system elements, as well as from the economic point of view. Some works on non-technical losses' minimization and identification have been developed [58][59][60], but this is still an area to be improved. At the same time, new data becomes available and suitable to be analyzed utilizing AI-based techniques.

Smart Grids
While cyber-security emerged as a very IT-focused discipline when the interconnection of local networks to the internet became a standard, we now acknowledge that the machineto-machine (M2M) communication, particularly the adoption of SG, gets more and more entangled. Hence the emergence of the concept of a cyber-physical system (CPS) embracing supervisory control and data acquisition (SCADA), industrial automation and control systems (ICAS), embedded command and control systems, and the IoT. Novel cyberphysical attacks have emerged [61], as well as advanced defenses. However, a significant limitation is that the security of a cyber-physical system cannot just be tackled by adding physical security at the OT level and cyber-security at the IT level. A new federative approach is required to assess the impact of cyber-incidents and countermeasures on grid operation and processes, identify vulnerabilities of state-of-the-art SCADA protocols in use, and identify the most likely attack scenarios in this environment.
Nations are dependent on the reliable functionality of critical infrastructure, such as electrical, gas, and water grids. Significant concerns have been highlighted in documents such as "Smart Grid Cyber Security Potential Threats, Vulnerabilities and Risks" [62], from the California State University Sacramento, the NIST "Guidelines for Smart Grid Cyber Security" [63], and at the European SG standards proposed by the European Smart Grids Task Force [64].
Smart grids applications are typically based upon client-server architecture. The security of those applications is primarily addressed to secure point-to-point communication between the gateway and applications servers. The role of the M2M service platform appears known as a critical component to ensuring interoperability between heterogeneous applications. Such a platform offers several services that simplify the coding of M2M applications and, more specifically, it enables a dynamic definition of the data flow. Furthermore, efforts have been undertaken by standardization bodies such as IETF, ETSI (now ONEM2M) to define standards for interoperable M2M service platforms [65,66]. However, with the advent of the M2M services platform, the communication model evolves from a point-to-point client-server model towards a point-to-multipoint peer-to-peer communication model.
From the security standpoint, the management of credentials used to secure M2M applications has been fairly static, and this also needs to evolve: The problem is not anymore to secure the communication from devices to the application server, but rather to secure communications from devices to every single application needing and authorized to interact with devices [67]. M2M applications commonly address authentication and data protection issues, but authorization is seldom addressed, which is regrettable. Fine-grain authorization management is an essential component of secure architecture, defining with precision which applications may interact with one device and how.
Also, implementing a security scheme is commonly related to the distribution of credentials [42]. Protecting the storage and use of those credentials is essential to avoid compromising security. The problem is challenging on the device side, where the theft of credentials opens the way to device cloning. Secure elements offer a proven solution to protect the storage of credentials in embedded appliances. Their enrolment and the management of the credentials stored in their memory are performed using specialized secure element management platforms that have been traditionally operated by the business entities issuing a secure element. Nevertheless, recent years have seen the emergence of the "security domain," enabling a single secure element to be exposed as a shared platform used by independent service providers. The underlying business model involves the secure element issuer "leasing" secure element space to third parties' providers for them to remotely store and manage their credentials in their private, secure space [68]. This model could apply to smart grids and smart grid devices as it opens the possibility for multitenant administration of the credentials stored in the devices. It supports emerging business models for smart grid operation. Modern approaches also propose the usage of blockchain-based decentralized and secure keyless signature schemes [31,69]. This idea of multitenant administration has emerged to enable multiple providers to offer mobile services requiring strong security for client-side credentials. Unfortunately, the use cases involved for mobile applications are incredibly diverse and sometimes very complex compared to IoT and, more specifically, smart grid use cases.
The need to support a large variety of use case configurations has a very significant impact on the cost of the process to manage the credentials on the secure elements remotely. Although mobile and IoT vertical domains share the same initial idea of multitenant secure element administration, different solutions should be used in each market segment, and cost-effective and straightforward secure element solutions are needed to make wide deployment possible.

Outlook and Future Work
In this section, we discuss current trends and future research and innovation directions for the surveyed areas of smart homes and grids. First of all, both smart homes and smart grids have become strong points of major innovation since they will benefit from the renewable energy sources (RES) revolution. They will also play a significant role in the advent of microgrids. We will elaborate on these topics in the following paragraphs. At the start, we provide an outlook on the new area of microgrids and then discuss further foreseen developments in our overviewed areas of smart homes and grids.

Microgrids
A microgrid is a decentralized group of electricity sources and loads that normally operates connected to a SG (or, more traditionally, a classic grid distribution infrastructure).
Microgrids can disconnect from the interconnected grid and function autonomously in "island mode" as technical or economic conditions dictate. In this way, microgrids improve the security of supply within the microgrid cell and supply emergency power, changing between the island and connected modes.
A microgrid can also use blockchain-related services to enable the "prosumer/consumer" mode. That means, in a nutshell, that each node/member from the microgrid could either generate/consume many energy services (energy). Blockchain is used in the microgrid scenario to exchange the remaining parts of the energy pool, called tokens. Each token represents an acceptable amount of energy that can be exchanged. We are currently working on these evolvements at the EU iDELTA project iDELTA: http://idelta.eu (accessed on 31 October 2021).

Smart Homes
While many works have been conducted on managing the buildings' energy efficiency, still too few efforts have been dedicated to standardized accounting of the energy performance of buildings. Legislatively, the European directives on building energy state that the member states should apply national energy efficiency schemes for energy service providers, energy audits, and other energy-saving measures. There are efforts towards energy standards, where enterprises can certify themselves in one of the available certifications, such as EN ISO 14000-Energy Management Systems, EN 16247-1-Energy Audits, or EN ISO 14000-Environmental Management Systems. Yet, the semantic representation of various energy performance certificates (EPCs) and the context of their use is still lacking, as well as their practical deployment.
Smart home technology has also undergone a huge revolution in terms of the so-called "domotic technology" that was very much focused on how to coordinate a number of elements, belonging to the home atmosphere, which could be activated, deactivated, and regulated from a remote perspective.
The evolution of smart home technology has come to an impasse, with several proprietary platforms which compete to get market share in a crowded business space.

Smart Grids
Smart meters are electronic devices that record/measure customer consumption, and other parameters, in time intervals of an hour or less and send that information over a communications network to the utility for monitoring and billing.
It is important to highlight the difference between automatic meter reading (AMR) and advanced metering infrastructure (AMI). All AMI systems contain AMR functionality, but all AMR systems are not AMI systems. Because of the inherent differences in AMR and AMI, the data available from each system differentiates them. AMI differs from traditional automatic meter reading (AMR) in that it enables two-way communications with the meter and typically provides substantial information, including cumulative electric energy usage, daily electric energy usage, power peak demand, last interval demand, load profile, voltage value, voltage profile; phase information, outage counts, tamper notification, electric energy time-of-use (TOU), and power peak readings.
With AMI systems, nearly all this information is available in real-time and on-demand, allowing for improved operations and customer management. AMI systems can also be used to verify power outages and service restoration, perform remote-service disconnects and reconnects, allow automated net metering, transmit demand-response and load-management messages, interrogate and control distribution-automation equipment and facilitate prepaid metering.
AMI provides the data that can be handled through AI and big data techniques to smooth these uncertainties. In addition, demand response and pricing programs that can be implemented via AMI systems allow the utility and customers many options to manage their usage.
Smart meter equipment in Europe, but also at a worldwide level, is ever increasing. Therefore, the SG becomes a huge source of insights coming from the combination of trailblazing algorithms and interaction data.
Future work in energy markets is also about the sustainable energy research on green Hydrogen that the EU is powering through their Next Generation funding lines. Green Hydrogen joins the new technological challenge of producing and supplying hydrogen from clean energy sources. To do so, 100% renewable electricity must be used in the electrolysis process, thus responding to the electrification and decarbonization needs of sectors such as industry or heavy transport.

Conclusions
Many substantial improvements have been accomplished with regard to the SG and smart home infrastructure in the past years, e.g., operational improvements, energy management improvements (including the increasing the awareness of user energy consumption), improvements in the field of predictive analytics, improvements in the interaction between the consumer, the technical home pieces of equipment and the smart grid). Further developments in various areas are outlined in the Energies journal's recent special issue, "Energy Efficiency in Smart Homes and Smart Grids" [70]. Based on this work, the conducted literature review, and our project experiences, we have described this field.
Security remains a major concern for smart grid and smart home systems, and will require special attention in future developments. Some security aspects that should be improved are secure communication among the smart grid actors, secure credentials and sensitive data storage, improvement of the security architecture (including secure communication protocols), and the safety of the technical devices. We also expect many further developments stemming from the fact that more and more data in the addressed areas will become available, such as the deployment of more intelligent systems on all levels and also ability to simulate and predict the smart grid and home environments, for which there is still not enough data. The trend towards decentralization will continue, including the evolution of the current developments in the area of blockchain, as well as developments in the new area of microgrids. Also, further combination and interoperation