## 3 System Description and Main Components
### The IoT Platform  
Synergies between various technologies are essential to conform the backbone of advanced digital twin interactions. The IoTMADLab controlled environment IoT platform is founded on Home Assistant, which serves as the main top-layer application and integrator for the whole system. This thoughtful choice was motivated by several critical factors that align with the goals and requirements of our project, emphasizing interoperability, scalability, and ease of integration with a wide array of IoT devices and protocols. Home Assistant provides an ideal platform to incorporate data from different vendors and third-party platforms, as it is highly expandable, open-source, and modular, while also prioritizing privacy and allowing molding of the local-cloud frontier as one may wish [36]. Some of the decisive key characteristics and benefits of Home Assistant are the following:  
* Open-Source and Community-Driven: Home Assistant's open-source nature fosters a vibrant community contributing to its continuous improvement. This aspect ensures the platform evolves in response to emerging IoT trends and technologies, providing a rich ecosystem of plugins, integrations, and support for a broad spectrum of devices and services, being virtually infinite. * Privacy-Centric and Local (or not) Control: Unlike many IoT platforms that solely rely on cloud-based logic, operation, and algorithms, Home Assistant pushes privacy and local control. This philosophy ensures that data generated by smart city services remain within Local Government's boundaries, mitigating privacy concerns, keeping data close, and lowering dependency on third-party cloud services. * Extensive Device Compatibility, Flexibility, and Customizability: Home Assistant supports a wide range of devices and protocols, making it an ideal choice for smart city applications. The platform's ability to seamlessly integrate devices across different manufacturers and communication protocols facilitates the development of cohesive and interoperable smart city services. The modular architecture of Home Assistant allows for high degrees of customization and flexibility. Home Assistant can be tailored to meet use cases' specific needs, ranging from environmental monitoring to urban mobility solutions. This adaptability, along with its rapid growth and constant improvement over the last years, extends the platform's applicability beyond home automation to more complex smart city infrastructures. * Scalability: Home Assistant's basal lightweight and efficient design ensure it can scale to accommodate the growing number of IoT devices and services within smart city ecosystems. This scalability is crucial for sustaining the dynamic expansion of smart city services and their evolving requirements. The IoT platform makes use of RESTful APIs and MQTT to communicate with IoT network gateways and management systems (CMS), retrieving data and sending commands. In addition, it integrates a state-of-the-art InfluxDB database for time-series data, which allows a very responsive, efficient, and accountable interaction with live events. By  
Figure 3: The different physical spaces of the IoTMADLab. (**a**) The integration and testing laboratory; (**b**) One area of the controlled environment with urban elements as streetlights and bike stations; (**c**) Another area with parking lots and green zones. integrating Home Assistant with InfluxDB and leveraging the communication capabilities of RESTful APIs and MQTT, the IoT platform bridges the gap between the physical and virtual worlds in real time, retrieving data to mirror the real world (MQTT) and sending commands to control the physical world from the virtual interface (REST). This integration provides a comprehensive solution for monitoring, controlling, and visualizing the events from IoT devices within the digital twin ecosystem. The IoT platform also integrates Grafana and Telegraf, allowing for the creation of dynamic and interactive dashboards.