# allmen/building-automation-system architecture

> Architecture diagram of the GitHub repository allmen/building-automation-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/allmen/building-automation-system
- Repository: https://github.com/allmen/building-automation-system

## Overview

##### Main Components
- Controller/Application Core: Represented by the BAS_Controller module which acts as the main logic hub.
- User Interface: Although the file tree only shows code, the README’s inclusion of a GUI image suggests a graphical interface component. Mark this as the UI layer that interacts with users.
- Sensor and Actuator Interfaces: The system’s description involves real-time sensor data (temperature, humidity, energy usage) and direct control over building equipment (lighting, door controls). Illustrate these as separate components communicating with the controller.
- System Logging: A dedicated component for capturing logs and activities. Even if integrated into the controller, it’s an important functional module.
- Future Integration Points: Optionally, include placeholders for future enhancements like AI-powered predictive analytics, IoT cloud connectivity, and voice/gesture control.

##### Relationships and Data Flow
- The Controller interacts with sensors (data coming in for real-time monitoring) and sends commands to actuators (lighting, door controls).
- Logging component recording each action or decision made, connected back to the Controller.
- For the scheduling and mode management modules, show both input from user scheduling configurations and automated sensor inputs that trigger changes in modes.

##### Architectural Patterns
- Event-Driven/Reactive Pattern: Emphasize that the system responds dynamically to sensor events or user commands, particularly for auto mode and real-time monitoring.
- Future Extensibility: Include loose coupling for external integrations, which hints at a microservices or plug-in approach for the planned AI, IoT, and advanced control features.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Core System Architecture"
        UI["User Interface (BAS_GUI)"]:::gui
        CTRL["BAS Controller"]:::controller
        MODE["Smart Scheduling & Mode Management"]:::scheduling
        SENSOR["Sensor Interface\n(Temperature,Humidity,Energy)"]:::sensor
        ACTUATOR["Actuator Interface\n(Lighting,Door Controls)"]:::actuator
        LOG["System Logging"]:::logging
        FUTURE["Future Integrations\n(AI,IoT,Voice/Gesture)"]:::future
    end

    UI -->|"UserCommands"| CTRL
    CTRL -->|"FeedbackUpdates"| UI
    SENSOR -->|"SensorData"| CTRL
    CTRL -->|"ControlCommands"| ACTUATOR
    CTRL -->|"ModeDecisions"| MODE
    CTRL -->|"ActivityLogging"| LOG
    CTRL ---|"PluggableInterface"| FUTURE

    classDef controller fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef gui fill:#87ceeb,stroke:#333,stroke-width:2px;
    classDef scheduling fill:#98fb98,stroke:#333,stroke-width:2px;
    classDef sensor fill:#ff9999,stroke:#333,stroke-width:2px;
    classDef actuator fill:#ffb6c1,stroke:#333,stroke-width:2px;
    classDef logging fill:#d3d3d3,stroke:#333,stroke-width:2px;
    classDef future fill:#ffa500,stroke:#333,stroke-width:2px,stroke-dasharray:5,5;

    click CTRL "https://github.com/allmen/building-automation-system/blob/main/src/BAS_Controller.py"
    click UI "https://github.com/allmen/building-automation-system/blob/main/README.md"
```
