Lunar Energy Plans API

Read or set overlay plans for short-term device dispatch

OpenAPI Specification

lunar-energy-plans-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Gridshare Customer Devices Plans 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: Plans
  description: Read or set overlay plans for short-term device dispatch
paths:
  /api/v2/devices/{synthId}/plans/overlay:
    parameters:
    - $ref: '#/components/parameters/SynthId'
    get:
      operationId: getDeviceOverlayPlan
      summary: Get Device Overlay Plan
      description: Get the current overlay plan for the device.
      tags:
      - Plans
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OverlayPlan'
    put:
      operationId: setDeviceOverlayPlan
      summary: Set Device Overlay Plan
      description: 'Set an overlay plan for the device. To delete an overlay plan,

        send an empty `commands` array in the request body.

        '
      tags:
      - Plans
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OverlayPlan'
      responses:
        '200':
          description: OK
  /api/v1/devices/{synthId}/plans/overlay:
    parameters:
    - $ref: '#/components/parameters/SynthId'
    get:
      operationId: getDeviceOverlayPlan
      summary: Get Device Overlay Plan
      description: Get the current overlay plan for the device.
      tags:
      - Plans
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OverlayPlan'
    put:
      operationId: setDeviceOverlayPlan
      summary: Set Device Overlay Plan
      description: 'Set an overlay plan for the device. To delete an overlay plan,

        send an empty `commands` array in the request body.

        '
      tags:
      - Plans
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OverlayPlan'
      responses:
        '200':
          description: OK
components:
  schemas:
    OverlayPlanCommand:
      type: object
      properties:
        start:
          type: string
          format: date-time
        end:
          type: string
          format: date-time
        action:
          type: string
          enum:
          - charge
          - discharge
          - hold
          - follow
        powerLimit_W:
          type: number
    OverlayPlan:
      type: object
      required:
      - commands
      properties:
        commands:
          type: array
          items:
            $ref: '#/components/schemas/OverlayPlanCommand'
  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