Aida Controller Project Structure
This document outlines the directory structure and organization of the Aida Controller codebase.
Directory Layout
aida_controller/
│
├── docs/ # Documentation (architecture, project structure, API docs, images)
│ ├── ARCHITECTURE.md
│ ├── PROJECT.md
│ └── Aida_Architecture.png
├── src/ # Main source code for the controller
│ ├── api/ # API endpoints (Flask blueprints)
│ │ ├── __init__.py
│ │ ├── health.py
│ │ └── models.py
│ ├── modules/ # Device integration modules (lighting, HVAC, sensors, etc.)
│ │ ├── fmp/ # Fan Motor Protection modules
│ │ ├── hvac/ # HVAC control modules
│ │ ├── lights/ # Lighting control modules
│ │ ├── sensors/ # Sensor modules
│ │ ├── shades/ # Shade control modules
│ │ └── switches/ # Switch control modules
│ ├── protocols/ # Protocol handlers (MQTT, CoAP, BACnet, etc.)
│ │ ├── __init__.py
│ │ ├── bacnetip_client.py
│ │ ├── bacnetip_server.py
│ │ ├── coap_client.py
│ │ ├── coap_server.py
│ │ ├── http_client.py
│ │ └── mqtt_client.py
│ ├── migrations/ # Database migrations (Alembic)
│ ├── static/ # Static files
│ │ └── firmware/ # Firmware files
│ ├── utils/ # Utility functions and helpers
│ │ └── __init__.py
│ ├── app.py # Main Flask application
│ ├── config.py # Configuration management
│ ├── db.py # Database connection and setup
│ ├── nginx.conf # Nginx configuration
│ ├── alembic.ini # Alembic configuration
│ └── requirements.txt # Python dependencies
├── frontend/ # Frontend container configuration
│ ├── Dockerfile
│ └── nginx.conf
├── aida_controller_ui/ # UI components (currently empty)
├── tests/ # Unit and integration tests
│ └── .keep
├── docker-compose.yml # Docker Compose configuration
├── docker-compose.deploy.yml # Production Docker Compose configuration
├── Dockerfile # Main application Dockerfile
├── deploy.sh # Deployment script
├── start_backend_command.sh # Backend startup script
├── start_backend_no_docker.sh # Backend startup without Docker
├── start_frontend_no_docker.sh # Frontend startup without Docker
├── env.example # Example environment variables
├── VERSION # Version file
├── README.md # Project overview and getting started
└── LICENSE # License information
Key Components
Source Code (src/)
The main application code is organized into several key directories:
api/- REST API endpoints using Flask blueprints for modular API designmodules/- Device-specific integration modules for different building systemsprotocols/- Protocol handlers for various communication standardsmigrations/- Database schema migrations managed by Alembicutils/- Shared utility functions and helper modules
Device Modules
The controller supports multiple building automation systems through dedicated modules:
- FMP (Fault Managed Power) - Power management and fault detection
- HVAC - Heating, ventilation, and air conditioning control
- Lighting - Intelligent lighting control and automation
- Sensors - Environmental and occupancy sensor integration
- Shades - Automated shade and blind control
- Switches - Network switch management and monitoring
Protocol Support
The controller implements multiple industry-standard protocols:
- HTTP/HTTPS - RESTful API communication
- MQTT/MQTTS - Lightweight IoT messaging
- CoAP - Constrained Application Protocol for resource-limited devices
- BACnet IP - Building automation standard protocol
Deployment Files
- Docker configuration - Containerized deployment setup
- Environment configuration - Example configuration files
- Startup scripts - Various deployment and development startup options