## 1 Introduction
For example, it collects data on electricity generation and consumption, which it then uses to build real consumption models to optimize the grid state in real-time. Since the planning horizons for energy production and consumption can be short--for example, one hour ahead--advanced smart grid automation will generate a considerable amount of operational data in a fast decision-making environment. New algorithms will help make them adaptive and capable of reasoned prediction. On the other hand, new rules for managing, operating, and marketing the grids will be needed. Figure 1: General IoT solution. We encounter IoT when addressing the energy performance of buildings in the context of energy sustainability, reducing energy consumption and CO2 emissions, which can now be considered as one of the fundamental society-wide challenges on the part of energy sustainability and the sustainability of the socioeconomic climate. Hence, the main focus of our research work is to create the conditions and prerequisites for the application of the Internet of Energy (IoE), or rather IoT, as IoE has a significant impact on the energy sector of smart cities [7]. IoE is the implementation of Internet of Things (IoT) technology into distributed energy systems and aims to achieve energy efficiency, prevent energy waste, and improve environmental conditions. At this point, the basic goals of our work can be set:  
1. Perform analysis of IoT applied protocols and transmission systems. 2. Define and design the basic energy model of the building(s) with the IoT integration as an indispensable feature of this platform. 3. Design the smart building (smart homes, smart offices, etc.) template. 4. Experiment. Methodological procedure for solving the energy performance of buildings (reduction of energy consumption and CO2). Thus, in our case, IoT allows objects under distributed energy systems, such as a RES microgrid, to be detected or operated directly through existing grid technology, enabling a tighter connection between the real world and the computer network, increasing energy efficiency through system optimization [8; 9]. Today, IoT is present on such a platform of applications that it is applicable in a vast field of science and technology [10]. It is mainly used in the fields of computing and informatics and big data processing, thus fulfilling the process conditions of a function of smart cities, namely mobile devices, charging stations for electromobility, smart monitoring, smart energy supply systems, process water supply, environmental safety, smart retail, smart supply chains, and online shopping [11; 12]. Over the last ten years or so, IoT platforms and services have changed with the development and availability of open-source hardware and the emergence of new technologies. Users should further educate themselves on IoT's new principles and applications and familiarize themselves with the technologies available in the market, which they could then apply in their activities and, thus, freely implement new technologies [13]. If IoE and IoT include, among others, the use of smart sensors and the integration of renewable energy, they become a tool of legal science to serve the purpose of a smart city. In this study, the European Union's decisions to draw up the Rules for facilitating the transformation of existing cities into smart buildings, starting with existing buildings, can be relied on. Therefore, a smart building template is designed to control the performance of all technical systems through IoT technology in order to achieve energy efficiency. In addition, an automatic remote control method supported by a cloud-based interface is proposed to improve the certification of existing buildings in terms of energy performance. This method minimizes time-consuming procedures, especially big data storage. It reduces the energy consumption of each building in terms of the basic essence of a smart building, i.e., reducing energy consumption and CO2 production.