Asoba Ona Documentation

Code Examples

The Ona Intelligence Layer SDK ships with runnable example files for both Python and JavaScript. Each example demonstrates a real-world workflow — from querying historical telemetry to streaming live data to running fault detection and diagnostics.

This section indexes every available example, organized by service. Browse the table below to find the example you need, then click through to the source on GitHub.

How to Run Examples

Prerequisites — Set the relevant environment variables for the services you want to use:

# Inverter Telemetry
export INVERTER_TELEMETRY_ENDPOINT=https://your-endpoint/prod
export INVERTER_TELEMETRY_API_KEY=your_api_key

# OODA Terminal
export OODA_TERMINAL_ENDPOINT=https://your-endpoint/prod
export OODA_TERMINAL_API_KEY=your_api_key

# Partner API
export PARTNER_API_ENDPOINT=https://your-endpoint/prod
export PARTNER_API_KEY=your_api_key

The same API key works for all endpoints — set it in each respective variable.

Run Python examples:

cd python
python3 examples/inverter_telemetry_example.py

Run JavaScript examples:

cd javascript
node examples/inverter-telemetry-example.js

Complete Workflow

The capstone example chains multiple services together — forecasting, fault detection, diagnostics, energy analyst queries, and maintenance scheduling. See the Complete Workflow walkthrough.

Language Filename Description
Python complete_workflow_example.py Multi-service integration: forecast → detect → diagnose → schedule

Inverter Telemetry

Query historical and stream live power output, energy, temperature, and state data from solar inverters. See the Inverter Telemetry service guide.

Language Filename Description
Python inverter_telemetry_example.py Discover data period, query historical telemetry (5-min & daily), stream live data with cursor-based resume
JavaScript inverter-telemetry-example.js Same workflow in JavaScript: data discovery, historical queries, live streaming with for await

OODA Terminal

Query and stream OODA (Observe, Orient, Decide, Act) alerts from terminal devices. See the OODA Terminal service guide.

Language Filename Description
Python ooda_terminal_example.py Discover data period, query terminal & site alerts, stream live alerts, cursor-based pagination
JavaScript ooda-terminal-example.js Same workflow in JavaScript: alert queries, site-wide alerts, live streaming, pagination

Terminal OODA (Detection & Diagnostics)

Run fault detection, diagnostics, create maintenance schedules, and query the ML model registry. See the Terminal OODA service guide.

Language Filename Description
Python terminal_ooda_example.py Run detection, diagnostics, create schedules, list activities, check ML models, get nowcast data
JavaScript terminal-api-example.js Terminal API operations: detection, diagnostics, scheduling, model registry

Forecasting

Generate solar production forecasts for sites and individual devices. See the Forecasting service guide.

Language Filename Description
Python forecasting_example.py Get site and device-level solar forecasts with configurable forecast horizons
JavaScript forecasting-example.js Same forecasting workflow in JavaScript

Freemium Forecasting

Access the free-tier forecasting API without an API key. See the Freemium Forecasting guide.

Language Filename Description
Python freemium_forecast_example.py Free-tier solar forecasts — no API key required
JavaScript freemium-forecast-example.js Free-tier forecasts in JavaScript

Energy Analyst

Query the energy analyst RAG system for compliance, maintenance, and regulatory information. See the Energy Analyst service guide.

Language Filename Description
Python energy_analyst_example.py Ask natural-language questions about energy compliance and maintenance

Partner API

Multi-tenant partner API for managing customers, sites, and assets. See the Partner API guide.

Language Filename Description
Python partner_api_example.py Manage customers, sites, and assets via the partner API
JavaScript partner-api-example.js Same partner API workflow in JavaScript

Edge Device

On-device SDK usage for local data processing at the edge. See the Edge Device guide.

Language Filename Description
Python edge_device_example.py Local data processing and edge device integration
JavaScript edge-device-example.js Edge device usage in JavaScript

Basic Usage

Language Filename Description
JavaScript basic-usage.js Minimal getting-started example for the JavaScript SDK

Python vs JavaScript Comparison

For a side-by-side comparison of how the two SDKs differ in syntax, initialization, and streaming patterns, see Python vs JavaScript.