Asoba Ona Terminal

Resources

Additional resources, examples, and community support for the Ona platform.

Documentation

Official Documentation

External Documentation

Code Examples

Python Examples

Basic Forecast Generation

from ona_sdk import OnaClient

# Initialize client
client = OnaClient("your-api-key")

# Upload historical data
upload_result = client.ingest_historical(
    customer_id="solar-farm-001",
    file_path="historical_data.csv",
    manufacturer="SolarEdge",
    location="CapeTown"
)

# Generate 24-hour forecast
forecast = client.generate_forecast(
    customer_id="solar-farm-001",
    forecast_horizon=24,
    model_type="lstm"
)

# Get results
results = client.get_forecast_results(
    customer_id="solar-farm-001",
    forecast_id=forecast["forecast_id"]
)

print(f"Forecast accuracy: {results['accuracy']}%")

Batch Processing

import asyncio
from ona_sdk import OnaClient

async def process_multiple_sites():
    client = OnaClient("your-api-key")
    
    sites = [
        {"id": "site-001", "location": "CapeTown"},
        {"id": "site-002", "location": "Johannesburg"},
        {"id": "site-003", "location": "Durban"}
    ]
    
    # Process all sites concurrently
    tasks = []
    for site in sites:
        task = client.generate_forecast(
            customer_id=site["id"],
            forecast_horizon=48
        )
        tasks.append(task)
    
    results = await asyncio.gather(*tasks)
    
    # Aggregate results
    total_forecast = sum(r["total_power"] for r in results)
    print(f"Total forecasted power: {total_forecast} MW")

Real-time Data Streaming

import asyncio
from ona_sdk import OnaClient

async def stream_solar_data():
    client = OnaClient("your-api-key")
    
    # Set up webhook for notifications
    webhook = await client.create_webhook(
        url="https://your-app.com/webhooks/solar-data",
        events=["data.ingested", "forecast.completed"]
    )
    
    # Stream real-time data
    async for data_point in client.stream_realtime_data():
        # Process incoming data
        processed_data = {
            "timestamp": data_point["timestamp"],
            "power": data_point["power"],
            "efficiency": data_point["power"] / data_point["capacity"]
        }
        
        # Send to forecasting API
        await client.ingest_nowcast(
            customer_id="solar-farm-001",
            data=processed_data
        )

JavaScript Examples

Browser Integration

<!DOCTYPE html>
<html>
<head>
    <title>Solar Forecast Dashboard</title>
    <script src="https://unpkg.com/ona-sdk@latest/dist/ona-sdk.min.js"></script>
</head>
<body>
    <div id="forecast-results"></div>
    
    <script>
        const client = new OnaClient('your-api-key');
        
        async function updateForecast() {
            try {
                const forecast = await client.generateForecast({
                    customerId: 'solar-farm-001',
                    forecastHorizon: 24
                });
                
                document.getElementById('forecast-results').innerHTML = 
                    `<h3>Forecast: ${forecast.total_power} MW</h3>`;
                    
            } catch (error) {
                console.error('Forecast error:', error);
            }
        }
        
        // Update forecast every hour
        updateForecast();
        setInterval(updateForecast, 3600000);
    </script>
</body>
</html>

Node.js Server Integration

const express = require('express');
const OnaClient = require('ona-sdk');

const app = express();
const client = new OnaClient('your-api-key');

app.post('/api/forecast', async (req, res) => {
    try {
        const { customerId, horizon } = req.body;
        
        const forecast = await client.generateForecast({
            customerId,
            forecastHorizon: horizon
        });
        
        res.json({
            success: true,
            forecast: forecast
        });
        
    } catch (error) {
        res.status(500).json({
            success: false,
            error: error.message
        });
    }
});

app.listen(3000, () => {
    console.log('Server running on port 3000');
});

Webhook Examples

Python Webhook Handler

from flask import Flask, request, jsonify
import hmac
import hashlib

app = Flask(__name__)

@app.route('/webhooks/ona', methods=['POST'])
def ona_webhook():
    # Verify webhook signature
    signature = request.headers.get('X-Ona-Signature')
    payload = request.get_data()
    
    if not verify_signature(payload, signature, 'your-webhook-secret'):
        return jsonify({'error': 'Invalid signature'}), 401
    
    # Process webhook event
    event = request.json
    
    if event['event'] == 'forecast.completed':
        # Handle forecast completion
        forecast_id = event['data']['forecast_id']
        customer_id = event['data']['customer_id']
        
        # Update your application state
        update_dashboard(customer_id, forecast_id)
        
    elif event['event'] == 'data.ingested':
        # Handle new data ingestion
        process_new_data(event['data'])
    
    return jsonify({'status': 'success'})

def verify_signature(payload, signature, secret):
    expected = hmac.new(
        secret.encode(),
        payload,
        hashlib.sha256
    ).hexdigest()
    
    return hmac.compare_digest(f"sha256={expected}", signature)

if __name__ == '__main__':
    app.run(debug=True)

Node.js Webhook Handler

const express = require('express');
const crypto = require('crypto');

const app = express();
app.use(express.json());

app.post('/webhooks/ona', (req, res) => {
    const signature = req.headers['x-ona-signature'];
    const payload = JSON.stringify(req.body);
    
    // Verify webhook signature
    const expectedSignature = crypto
        .createHmac('sha256', 'your-webhook-secret')
        .update(payload)
        .digest('hex');
    
    if (signature !== `sha256=${expectedSignature}`) {
        return res.status(401).json({ error: 'Invalid signature' });
    }
    
    // Process webhook event
    const event = req.body;
    
    switch (event.event) {
        case 'forecast.completed':
            handleForecastCompleted(event.data);
            break;
        case 'data.ingested':
            handleDataIngested(event.data);
            break;
        default:
            console.log('Unknown event:', event.event);
    }
    
    res.json({ status: 'success' });
});

function handleForecastCompleted(data) {
    console.log('Forecast completed:', data.forecast_id);
    // Update your application state
}

function handleDataIngested(data) {
    console.log('New data ingested:', data.customer_id);
    // Process new data
}

app.listen(3000, () => {
    console.log('Webhook server running on port 3000');
});

Tutorials

Getting Started Tutorials

  1. First Forecast: Create your first energy forecast
  2. Data Integration: Connect your solar monitoring system
  3. Real-time Dashboard: Build a real-time monitoring dashboard

Advanced Tutorials

  1. Custom Models: Train custom forecasting models
  2. Multi-site Management: Manage multiple solar sites
  3. Energy Trading: Integrate with energy markets

Community

Support Channels

Community Resources

Events

Tools and Utilities

Development Tools

Monitoring and Analytics

API Status and Monitoring

Real-time Status

Monitoring Endpoints

# Health check
curl https://yn058ezh38.execute-api.af-south-1.amazonaws.com/prod/health

# Status check
curl https://status.asoba.co/api/v1/status

# Performance metrics
curl https://status.asoba.co/api/v1/metrics

Security

Security Resources

Security Tools

Training and Certification

Training Programs

Learning Paths

  1. Beginner: Fundamentals of energy forecasting
  2. Intermediate: Advanced API integration
  3. Advanced: Custom model development

Contributing

Open Source

Community Projects

Contact

General Inquiries

Technical Support

Social Media