## 1 Introduction  
As renewable energy sources become increasingly important in the face of climate change, the challenges accompanied by their volatile energy supply, primarily the potential imbalance between energy supply and demand, must be addressed. Furthermore, the transition to electric mobility poses additional difficulties, especially in the context of high power chargers. Therefore, in order to facilitate the balance between energy supply and demand, and guarantee the safe operation of the electrical grid, the wide-spread implementation of demand side management (DSM) measures is required. One issue in this context is the communication with distributed energy resources (DERs), such as combined heat and power plants, battery storage systems, and electric vehicle (EV) charging stations. In Germany, the so-called Smart Meter Gateways (SMGWs) play a crucial role in enabling DSM measures by allowing bidirectional communication with DERs. In 2009 the _EU directive 2009/72 EC_[1] was passed. It constitutes the compulsory rollout of a smart metering infrastructure for the individual members of the EU, in case of a positive macroeconomic assessment. For Germany, this assessment was released with a positive result [2] in 2013. Three yearslater, in 2016, the _German Act on the Digitization of the Energy Transition_ (\"Gesetz zur Digitalisierung der Energiewende\") [3] was passed, which introduced the new _German Metering Point Operation Law_ (\"Messstellenbetriebsgesetz,\" MsbG). The MsbG defines regulations for the compulsory rollout of _intelligent metering systems_ (\"Intelligente Messsysteme,\" iMSys) [4]. Per the definition, an iMSys consists of two elements, a metering device providing certain interfaces (\"Moderne Messeinrichtung,\" mME) and a SMGW [4]. By law (SS30 MsbG), the rollout starts with the availability of iMSys from at least three independent manufacturers fulfilling all defined requirements. As of February 2020, this condition is officially met [5]. SMGWs bridge the gap between local devices, that is, metering devices and DERs, and external entities that require access to these, e.g., for billing. To achieve this, the SMGWs provide interfaces in three distinguished communication networks, and functionality for processing metering data. Which information can be accessed and how it is communicated depends on the configuration of the SMGW [6]. This paper presents a prototype integrating an automated decentralized energy management system (EMS)--a core component for controlling DERs in smart buildings and smart factories--into the German SMGW infrastructure. With the prototype we aim to answer the following three research questions focusing on the German SMGW as novel communication platform:  
* How can DSM via a decentralized EMS be implemented within the German SMGW infrastructure, and which design choices have to be made? * To which extent does the SMGW infrastructure protect private data when integrating an EMS? * Where does standardization hinder or support the integration of EMS into the SMGW infrastructure? Given these questions, please note that the goal of the prototype is not the proposal or investigation of novel DSM schemes. Building upon the findings presented in this paper, it is possible to implement any DSM approach. Hence, we test whether requests are executed rather than providing a quantitative analysis. Besides an iMSys the prototype comprises a charging station for electric vehicles (EV), an automated EMS which optimizes local energy flows, and a demand side manager (DSMgr). Detailed information on the communication architecture and the implementation of both the EMS and the DSMgr is given in this paper. A link to the source code of the individual components can be found in the reference to supplementary materials at the end of the paper. The presented architecture is by no means restricted to EVs, additional DERs could be added. Furthermore, challenges in the correct configuration of SMGWs are outlined.