Control Layer
The Control Layer aggregates predictions from all active nodes, executes Decision AI routines for task scheduling and coordination, and provides secure APIs for integration with maintenance management systems.
Overview
The Control Layer serves as the central coordination hub for the Ona Platform. It aggregates predictions from all edge nodes, executes Decision AI routines for task scheduling and coordination, maintains a unified dashboard for operators, and provides secure APIs for integration with maintenance management systems such as SAP PM or Maximo.
Key Capabilities:
- Aggregates predictions from all active edge nodes
- Executes Decision AI routines for task scheduling and coordination
- Maintains unified dashboard for operators
- Provides secure APIs for CMMS integration
- Manages authentication and authorization
- Handles rate limiting and request validation
API Gateway
Base URLs
The Ona Platform exposes a RESTful API through AWS API Gateway:
- Custom Domain:
https://api.asoba.co✅ LIVE - Direct API Gateway:
https://2m5xvm39ef.execute-api.af-south-1.amazonaws.com/prod
API Gateway Configuration
Status: ✅ ACTIVE
- API Gateway ID:
2m5xvm39ef - Region:
af-south-1 - Environment:
prod - Stage:
prod
Features
- Request Routing: Routes requests to appropriate Lambda functions
- Load Balancing: Distributes traffic across multiple Lambda instances
- Custom Domain Support: Supports custom domain (api.asoba.co)
- SSL/TLS: HTTPS only with TLS 1.2+
- Request Validation: JSON schema validation for all requests
Terminal API Endpoints (OODA Workflow)
The Control Layer provides comprehensive Terminal API endpoints that implement the OODA (Observe-Orient-Decide-Act) workflow for operations and maintenance.
POST /terminal/assets
Manage solar assets and components.
Purpose: Create, list, and retrieve asset information
Authentication: API key or IAM role
Content-Type: application/json
Actions:
add: Create new assetlist: List all assetsget: Retrieve specific asset details
Example Request (add):
{
"action": "add",
"asset_id": "INV-001",
"name": "Main Inverter 1",
"type": "Solar Inverter",
"capacity_kw": 20.0,
"location": "Cape Town Solar Farm",
"components": [
{
"oem": "Sungrow",
"model": "SG20KTL",
"serial": "SN123456"
}
]
}
Example Response:
{
"message": "Asset created successfully",
"asset_id": "INV-001"
}
POST /terminal/detect
Run fault detection on assets.
Purpose: Execute anomaly detection and fault identification
Authentication: API key or IAM role
Actions:
run: Execute fault detectionlist: List detection results
Example Request:
{
"action": "run",
"asset_id": "INV-001"
}
Example Response:
{
"message": "Detection completed",
"asset_id": "INV-001",
"detections": []
}
POST /terminal/diagnose
Run AI diagnostics on detected faults.
Purpose: Classify faults and provide root cause analysis
Authentication: API key or IAM role
Actions:
run: Execute diagnosticslist: List diagnostics results
Example Request:
{
"action": "run",
"asset_id": "INV-001"
}
Example Response:
{
"message": "Diagnostics completed",
"asset_id": "INV-001",
"diagnostics": []
}
POST /terminal/schedule
Create maintenance schedules.
Purpose: Schedule maintenance activities and optimize resource allocation
Authentication: API key or IAM role
Actions:
create: Create new schedulelist: List all schedules
Example Response:
{
"message": "Schedule created",
"schedule_id": "sched-uuid"
}
POST /terminal/bom
Build bill of materials for maintenance.
Purpose: Generate parts lists and cost estimates for maintenance jobs
Authentication: API key or IAM role
Actions:
build: Generate BOMlist: List existing BOMs
Example Response:
{
"message": "BOM built",
"bom_id": "bom-uuid"
}
POST /terminal/order
Create work orders.
Purpose: Generate work orders for maintenance execution
Authentication: API key or IAM role
Actions:
create: Create new work orderlist: List all work orders
Example Response:
{
"message": "Order created",
"order_id": "ord-uuid"
}
POST /terminal/track
Track job status and progress.
Purpose: Monitor work order execution and job progress
Authentication: API key or IAM role
Actions:
subscribe: Subscribe to job trackinglist: List tracking subscriptions
Example Response:
{
"message": "Tracking subscription created",
"job_id": "job-uuid"
}
Authentication and Security
API Key Authentication
Include your API key in the request header:
curl -H "X-API-Key: your-api-key" \
-X POST https://api.asoba.co/terminal/assets
Or as a query parameter:
curl "https://api.asoba.co/forecast?customer_id=test&api_key=your-api-key"
IAM Role Authentication
Use AWS credentials for authentication:
# Configure AWS credentials
aws configure
# Use AWS signature in requests
curl -H "Authorization: AWS4-HMAC-SHA256 ..." \
-X POST https://api.asoba.co/terminal/assets
Security Headers
- CORS: Configured for specific origins
- Rate Limiting: 1000 requests per hour per API key (standard tier)
- Request Validation: JSON schema validation
- SSL/TLS: HTTPS only with TLS 1.2+
- Certificate-Based Authentication: Secure device authentication
Request/Response Formats
Standard Response Format
All successful API responses follow this structure:
{
"success": true,
"data": {
// Response data
},
"metadata": {
"request_id": "uuid",
"timestamp": "2025-01-15T12:00:00Z",
"version": "v1.0"
},
"errors": []
}
Error Response Format
Error responses follow this structure:
{
"success": false,
"data": null,
"metadata": {
"request_id": "uuid",
"timestamp": "2025-01-15T12:00:00Z",
"version": "v1.0"
},
"errors": [
{
"code": "VALIDATION_ERROR",
"message": "Invalid customer_id format",
"field": "customer_id",
"details": "Expected format: alphanumeric string"
}
]
}
Rate Limiting and Quotas
Rate Limits by Tier
| Tier | Requests/Hour | Burst Limit |
|---|---|---|
| Standard | 1,000 | 100 |
| Premium | 10,000 | 1,000 |
| Enterprise | 100,000 | 10,000 |
Rate Limit Headers
Rate limit information is included in response headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 755
X-RateLimit-Reset: 1642248000
Quota Exceeded Response
When rate limit is exceeded:
{
"success": false,
"data": null,
"errors": [
{
"code": "QUOTA_EXCEEDED",
"message": "Rate limit exceeded. Try again later.",
"retry_after": 3600
}
]
}
HTTP Status: 429 Too Many Requests
Task Scheduling and Coordination
Decision AI Routines
The Control Layer executes Decision AI routines that:
- Aggregate Predictions: Combine forecasts from all edge nodes
- Calculate Energy-at-Risk: Determine financial impact of faults
- Optimize Scheduling: Balance maintenance needs with production goals
- Resource Allocation: Assign crews and resources efficiently
- Cost Optimization: Minimize dispatch costs while maximizing revenue protection
Unified Dashboard
The Control Layer maintains a unified dashboard for operators that provides:
- Real-Time Status: Current operational status of all assets
- Risk Scores: Energy-at-risk calculations for each asset
- Active Work Orders: List of pending and in-progress maintenance
- Performance Metrics: Aggregated performance data across the portfolio
- Alert Management: Centralized alert and notification system
CMMS Integration
Supported Systems
The Control Layer provides secure APIs for integration with maintenance management systems:
- SAP PM: SAP Plant Maintenance integration
- Maximo: IBM Maximo Asset Management integration
- Custom CMMS: RESTful API for custom system integration
Integration Features
- Work Order Sync: Automatic work order creation and status updates
- Asset Management: Bidirectional asset data synchronization
- Maintenance History: Historical maintenance data exchange
- Parts Management: Bill of materials and inventory integration
- Scheduling: Maintenance schedule synchronization
API Integration Example
# Create work order via API
curl -X POST https://api.asoba.co/terminal/order \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"action": "create",
"asset_id": "INV-001",
"priority": "high",
"description": "Inverter fault detected"
}'
Lambda Services
The Control Layer is powered by the Terminal API Lambda function:
Terminal API Service
ona-terminalApi-prod
- Memory: 1024MB
- Timeout: 300 seconds (5 minutes)
- Purpose: Handles all Terminal API endpoint requests
- Capabilities:
- OODA workflow execution
- Asset management
- Fault detection and diagnostics
- Maintenance scheduling
- Work order generation
- Job tracking
Data Management
DynamoDB Tables
The Control Layer uses DynamoDB tables for data storage:
Terminal Tables:
ona-platform-terminal-assets: Asset informationona-platform-terminal-schedules: Maintenance schedulesona-platform-terminal-boms: Bill of materialsona-platform-terminal-orders: Work ordersona-platform-terminal-tracking: Job tracking data
Platform Tables:
ona-platform-locations: Location and customer dataona-platform-weather-cache: Weather data cache
S3 Storage
Input Bucket: sa-api-client-input
- Receives data from edge nodes
- Stores historical and real-time data
Output Bucket: sa-api-client-output
- Stores generated forecasts
- Stores model artifacts
- Stores diagnostic results
Monitoring and Observability
CloudWatch Integration
- Log Groups: Centralized logging for all API requests
- Metrics: Request counts, latency, error rates
- Alarms: Automated alerts for service issues
- Dashboards: Real-time monitoring dashboards
Performance Metrics
- Average Response Time: < 2 seconds
- P95 Response Time: < 5 seconds
- Error Rate: < 0.1%
- Availability: 99.9%+
Next Steps
- Edge Layer - Learn about the edge computing layer
- Interface Layer - Explore the user interface and dashboards
- Developer API Guide - Complete API documentation
Get Help & Stay Updated
Contact Support
For technical assistance, feature requests, or any other questions, please reach out to our dedicated support team.
Email Support Join Our Discord