# Leveraging Retrieval-Augmented Generation for Automated Smart Home Orchestration
## 4 Test Scenarios and Validation Results
### Single-Device Service Bundle Generation  
The second test scenario examines the system's capacity to generate and deploy an automation service for a single device in response to a user request expressed in natural language. This scenario provides evidence of functional correctness, since it verifies whether the orchestrator can accurately interpret user commands and produce valid service bundles for corresponding device actions.  
A user request was composed to reflect a simple, yet realistic use case: \"Turn on the heater in the bedroom and set it to 25\". Upon receiving this request, the orchestrator parsed the text and identified a suitable device, ensuring that the requirement was correctly matched to the Bedroom Heater. Figure 9 displays the user input alongside the system's confirmation of the selected device, thus validating the orchestrator's ability to translate natural language instructions into a concrete device mapping.  
Once the correct device was located, the orchestrator prompted the AI component to generate the necessary Java code for an OSGi-compliant bundle. The system provided the relevant device interface details to the large language model, which returned a class implementation that invoked the heater's methods to turn it on and set the desired temperature. The orchestrator subsequently compiled and packaged this class into a bundle, following the OSGi standards required by the Apache Felix runtime. Figure 10 documents the code generation process, confirming that the service bundle was installed and started successfully, while Figures 11-13 present the resulting Java code, manifest, and component descriptor.  
Figure 8: Apache Felix _scr:list_ command output verifying the active registration of the device bundle service (Smart Temperature) in the system’s Service Registry.  
Figure 9: User input and corresponding device selection process for a single-device automation scenario, illustrating natural language understanding and semantic device matching.  
Figure 11: Generated Java code for the Bedroom Heater service bundle, showing the structure and OSGi-compliant annotations produced by the AI component.  
Figure 12: Manifest file generated for the Bedroom Heater bundle, detailing the imported packages and bundle metadata required for successful OSGi deployment.  
Figure 10: Terminal logs documenting Java code generation, compilation, and bundle deployment for the Bedroom Heater service in the orchestrator.  
To verify that the heater responded to the new bundle, the logs in Figure 14 confirmed the bundle's activation in Apache Felix. The orchestrator's console reflected the correct execution of the user's instruction, and Figure 15 lists the newly registered service in the OSGi Service Registry. Lastly, Figure 16 illustrates the bundle's Active status in the Apache Felix web console, confirming that the system effectively carried out the requested automation.  
Through these steps, the orchestrator demonstrated that it can transform a user's natural language command into a working OSGi service bundle with minimal human intervention. The success of this single-device test case highlights the orchestrator's functional correctness and offers a foundation for more complex scenarios involving multiple devices.