Telemetry
Real-time and historical telemetry data — SSE streams, REST queries, and MQTT topics.
Novacore provides multiple ways to access telemetry data from your energy devices.
Real-time: Server-Sent Events (SSE)
SSE provides a persistent HTTP connection that streams telemetry events as they arrive. This is the recommended approach for web applications.
Stream Site Telemetry
GET /stream/sites/{site_id}
Headers:
Authorization: Bearer YOUR_JWT_TOKEN
Accept: text/event-stream
Example with curl:
curl -N https://novacore-mainnet.sourceful.dev/stream/sites/sit-abc123 \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Accept: text/event-stream"
Example with JavaScript:
const eventSource = new EventSource(
`https://novacore-mainnet.sourceful.dev/stream/sites/${siteId}`,
{
headers: {
Authorization: `Bearer ${token}`,
},
}
);
eventSource.onmessage = (event) => {
const reading = JSON.parse(event.data);
console.log(reading);
// { type: "pv", W: -1500, timestamp: 1709740800000, ... }
};
eventSource.onerror = () => {
// Reconnect logic
console.log("Connection lost, reconnecting...");
};
Example with Python:
import sseclient
import requests
url = f"https://novacore-mainnet.sourceful.dev/stream/sites/{site_id}"
headers = {"Authorization": f"Bearer {token}"}
response = requests.get(url, headers=headers, stream=True)
client = sseclient.SSEClient(response)
for event in client.events():
reading = json.loads(event.data)
print(f"{reading['type']}: {reading.get('W', 'N/A')}W")
Knowledge gap for Johan: What is the exact SSE event format? Is it data: {json}\n\n or does it include event types? What query parameters are supported (e.g., filtering by DER type)?
Real-time: WebSocket
GET /ws
WebSocket connection for bidirectional real-time communication.
Knowledge gap for Johan: What is the WebSocket protocol? What messages can be sent/received? Is this for telemetry only, or also control?
MQTT Topics (For Backend Services)
Telemetry flows through NATS/MQTT topics. These are primarily for backend integrations with approved NATS access.
Gateway-side (Raw)
gateways/{serial}/devices/{hardware_id}/ders/{der_name}/telemetry/json/v1
Organization-side (Enriched)
After the Topic Router enriches and re-routes:
orgs/{org_id}/sites/{site_id}/devices/{device_id}/ders/{der_id}/telemetry/json/v1
Telemetry Payload
Payloads follow the Data Models schemas:
PV:
{
"type": "pv",
"make": "Sungrow",
"W": -2500,
"rated_power_W": 10000,
"mppt1_V": 400,
"mppt1_A": -6.25,
"total_generation_Wh": 150000,
"timestamp": 1709740800000,
"read_time_ms": 45
}
Battery:
{
"type": "battery",
"make": "BYD",
"W": 3000,
"SoC_nom_fract": 0.42,
"V": 51.2,
"A": 58.6,
"total_charge_Wh": 85000,
"total_discharge_Wh": 78000,
"timestamp": 1709740800000
}
Meter:
{
"type": "meter",
"make": "Kamstrup",
"W": 850,
"Hz": 50.01,
"L1_V": 230, "L1_A": 3.7,
"L2_V": 231, "L2_A": 0.0,
"L3_V": 229, "L3_A": 0.0,
"total_import_Wh": 42000,
"total_export_Wh": 31000,
"timestamp": 1709740800000
}
Historical Data
Knowledge gap for Johan: What REST endpoints exist for querying historical telemetry? What query parameters are available (time range, resolution, aggregation)? Is historical data stored in VictoriaMetrics and exposed via REST, or is there a separate query API?
JetStream Retention
| Stream | Subjects | Retention |
|---|---|---|
GATEWAY_TELEMETRY | gateways.> | 24 hours |
ENRICHED_TELEMETRY | orgs.*.sites.*.devices.*.ders.*.telemetry.> | 7 days |
Related Documentation
- Data Models - Telemetry schemas for all DER types
- Real-time Data Guide - Building real-time dashboards