openapi: 3.1.0 info: title: Gridshare Customer Devices Telemetry API description: 'The Gridshare Customer API is the homeowner-delegated surface of Lunar Energy''s Gridshare DERMS platform. It allows partners — apps, installers, retailers — to read or control devices on behalf of a specific Lunar Energy customer once that customer has granted consent via OAuth 2.0 Authorization Code flow against the lunar-customer Amazon Cognito user pool. Four scopes are available: `lunar/device.read`, `lunar/device.write`, `lunar/plan.read`, `lunar/plan.write`. ' version: v1.0 contact: name: Lunar Energy url: https://www.gridshare.com email: developers@gridshare.com x-logo: url: https://www.lunarenergy.com/favicon.ico servers: - url: https://developer-api.customer.mygridshare.com description: Production server - url: https://developer-api.customer.dev0.mygridshare.com description: Development server security: - bearerAuth: [] tags: - name: Telemetry description: Time-bucketed per-sensor telemetry readings paths: /api/v2/devices/{synthId}/telemetry: parameters: - $ref: '#/components/parameters/SynthId' get: operationId: getDeviceTelemetry summary: Get Device Telemetry description: "Time-bucketed telemetry for a single device sensor stream.\n`synthId` must be a **sensor ID** from the site topology — any node\nwith `\"kind\": \"sensor\"`. On most installations telemetry streams\nare keyed by derived sensor IDs such as\n`__GRID_METER_DERIVED`, `__bb_agg`, and\n`__PV_DERIVED`.\n\n`energy_Wh_increment` and `energy_Wh_decrement` are populated only\nwhen `include=energy` (or `include=default,energy`):\n - `energy_Wh_increment` — lifetime cumulative energy flowing **into** the device (positive)\n - `energy_Wh_decrement` — lifetime cumulative energy flowing **out of** the device (negative)\n" tags: - Telemetry parameters: - in: query name: include schema: type: string - in: query name: start schema: type: string format: date-time - in: query name: end schema: type: string format: date-time - in: query name: bucket schema: type: string responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Telemetry' /api/v1/devices/{synthId}/telemetry: parameters: - $ref: '#/components/parameters/SynthId' get: operationId: getDeviceTelemetry summary: Get Device Telemetry description: 'Get time-bucketed telemetry for a device or sensor. `synthId` can be a device ID or a sensor ID from the site topology. Supported device kinds: `inverter`, `battery_pack`, `PV`, `EV`, `meter`, `load_control_relay`. Include `energy_Wh_increment` and `energy_Wh_decrement` by passing `include=default,energy`. ' tags: - Telemetry parameters: - in: query name: include schema: type: string description: Comma-separated set of telemetry fields. `energy` is opt-in. - in: query name: start schema: type: string format: date-time - in: query name: end schema: type: string format: date-time - in: query name: bucket schema: type: string description: Time-bucket size (e.g. `PT1H`). responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Telemetry' /api/v1/counterfactuals/{counterfactualName}/devices/{deviceId}/telemetry: parameters: - in: path name: counterfactualName required: true schema: type: string - in: path name: deviceId required: true schema: type: string get: operationId: getCounterfactualTelemetry summary: Get Counterfactual Telemetry description: 'Counterfactual telemetry — what the device would have done if it had not been smartly controlled. Availability depends on the counterfactuals enabled for your partner account. ' tags: - Telemetry responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Telemetry' components: schemas: Telemetry: type: object properties: entries: type: array items: type: object properties: timestamp: type: string format: date-time power_W: type: number voltage_V: type: number current_A: type: number stateOfCharge_pct: type: number energy_Wh_increment: type: number energy_Wh_decrement: type: number parameters: SynthId: in: path name: synthId required: true schema: type: string description: A device ID or a sensor ID from the site topology. securitySchemes: bearerAuth: type: oauth2 description: 'OAuth 2.0 Authorization Code flow against the lunar-customer Amazon Cognito user pool. ' flows: authorizationCode: authorizationUrl: https://lunar-customer-prod-us-west-1.auth.us-west-1.amazoncognito.com/oauth2/authorize tokenUrl: https://lunar-customer-prod-us-west-1.auth.us-west-1.amazoncognito.com/oauth2/token refreshUrl: https://lunar-customer-prod-us-west-1.auth.us-west-1.amazoncognito.com/oauth2/token scopes: lunar/device.read: Read device metadata and telemetry (excluding plans) lunar/device.write: Modify devices including operation mode lunar/plan.read: Read existing device plans lunar/plan.write: Send plans to a device