Resources
Additional resources, examples, and community support for the Ona platform.
Documentation
Official Documentation
- ๐ API Reference: Complete API documentation
- ๐ Getting Started: Quick start guide
- ๐ ๏ธ Deployment Guide: Production deployment
- ๐ Integration Guide: SDK and webhook integration
- ๐จโ๐ป Development Guide: Contributing to the platform
External Documentation
-
๐ AWS Documentation: AWS Lambda API Gateway -
๐ Python SDK: PyPI Package GitHub Repository -
๐จ JavaScript SDK: NPM Package GitHub Repository
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
- First Forecast: Create your first energy forecast
- Data Integration: Connect your solar monitoring system
- Real-time Dashboard: Build a real-time monitoring dashboard
Advanced Tutorials
- Custom Models: Train custom forecasting models
- Multi-site Management: Manage multiple solar sites
- Energy Trading: Integrate with energy markets
Community
Support Channels
- ๐ฌ Discord Community: Join our Discord
- ๐ง Email Support: support@asoba.co
- ๐ GitHub Issues: Report bugs and request features
- ๐ก GitHub Discussions: Community discussions
Community Resources
- ๐บ YouTube Channel: Tutorial videos and demos
- ๐ฐ Blog: Technical articles and updates
- ๐๏ธ Podcast: Energy tech discussions
- ๐ Status Page: System status and uptime
Events
- ๐๏ธ Webinars: Monthly technical webinars
- ๐ข Meetups: Local community meetups
- ๐ช Conferences: Energy and tech conferences
Tools and Utilities
Development Tools
- ๐ง API Testing: Postman Collection
- ๐ Data Visualization: Jupyter Notebooks
- ๐งช Testing Framework: Test suites and examples
- ๐ CLI Tools: Command-line utilities
Monitoring and Analytics
- ๐ Grafana Dashboards: Pre-built monitoring dashboards
- ๐ Prometheus Metrics: System metrics and alerts
- ๐ Log Analysis: Log parsing and analysis tools
API Status and Monitoring
Real-time Status
- ๐ง API Status: status.asoba.co
- ๐ Performance Metrics: Performance dashboard
- ๐จ Incident History: Past incidents and resolutions
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 Policy: Security guidelines and best practices
- ๐ก๏ธ Vulnerability Reporting: Report security issues
- ๐ Compliance: SOC 2, ISO 27001 compliance
Security Tools
- ๐ API Key Management: Secure key rotation and management
- ๐ก๏ธ Access Control: IAM and permission management
- ๐ Audit Logs: Security audit and compliance logs
Training and Certification
Training Programs
- ๐ Developer Certification: Ona Platform Developer Certification
- ๐ Online Courses: Self-paced learning modules
- ๐จโ๐ซ Instructor-led Training: Custom training programs
Learning Paths
- Beginner: Fundamentals of energy forecasting
- Intermediate: Advanced API integration
- Advanced: Custom model development
Contributing
Open Source
- ๐ GitHub Repository: Main repository
- ๐ค Contributing Guide: How to contribute
- ๐ Code of Conduct: Community guidelines
Community Projects
- ๐ง Community Tools: Tools built by the community
- ๐ Community Examples: Examples and tutorials
- ๐จ Community Themes: UI themes and customizations
Contact
General Inquiries
- ๐ง General: hello@asoba.co
- ๐ผ Business: business@asoba.co
- ๐ค Partnerships: partnerships@asoba.co
Technical Support
- ๐ง Technical: support@asoba.co
- ๐ Integration: integrations@asoba.co
- ๐จโ๐ป Development: dev@asoba.co