This is the documentation for the endpoints implemented by Virtual Power Plants (VPPs) for integrating devices with the Gravity Connect API.
The endpoints that a Device Partner implements are described in the Device Partner Guide.
Below are any noteworthy changes to the API spec.
Publish device enrollmentdevice key in the Publish device enrollment status to refer to the device details rather than just the kind of deviceGravity Connect uses the following authentication models:
Requests from the VPP to the Device Partner's endpoints
clientId: A program-specific ID.clientSecret: A program-specific secret.Requests from the Device Partner to the VPP's endpoints
PUBLISH_SECRET.PROGRAM_PUBLISH_KEY: The unique identifier for a utility program, provided when a program is set up.PROGRAM_PUBLISH_SECRET: The secret key used to generate HMAC signatures when publishing program-level data, provided when a program is set up.DEVICE_PUBLISH_SECRET: The secret key used to generate HMAC signatures when publishing device-level data, provided when each device is enrolled.To authenticate with the VPP's endpoints:
PROGRAM_PUBLISH_SECRET or DEVICE_PUBLISH_SECRET, as specified for that endpoint.Example: Authorization: Publish 12345abcdef
The below script is an example of how to generate an HMAC for some payload in javascript. Other languages should have standard crypto libraries that work similarly.
const crypto = require('crypto');
const secret = 'your_secret_here';
const body = `{
"uid": "your_device_uid",
"kind": "TSTAT",
"signal": [{
"key": "mode",
"value": "HEAT",
"time": "2021-01-28T15:36:48.586697"
}],
"setting": [{
"key": "max-setpoint",
"value": 31.0,
"time": "2020-10-20T22:10:57.101616"
}]
}`;
const computedHMAC = crypto.createHmac('sha256', secret).update(body).digest('hex');
console.log(`Publish ${computedHMAC}`);
For the following error codes, please retry using exponential backoff:
All other requests that receive an error should be discarded.
All of the endpoints below allow the Device Partner to publish data to the Virtual Peaker platform, which avoids Virtual Peaker having to constantly poll the data when there haven't been any changes. Part of the Device Partner Implementation does include endpoint to read poll for data, which could be used by Virtual Peaker to gather the first batch of data or for debugging.
Notes:
This endpoint publishes device data to Virtual Peaker. The signal and setting types vary by device type. Please reference the Device Specific Definitions section to see the signals and settings for each device. Also, a required field is required overall for that device although not required every time data is reported for that device.
| PROGRAM_PUBLISH_KEY required | string The identifier of the program within Virtual Peaker |
| Authorization required | string^Publish [a-f\d]+$
|
| uid required | string The partner's unique device identifier |
| kind required | string (DeviceKindEnum) Enum: "HWH" "TSTAT" "BATTERY" "EVSE" "V2G" "STORAGE-HVAC" |
required | Array of objects (SignalSetting) |
required | Array of objects (SignalSetting) |
{- "uid": "string",
- "kind": "HWH",
- "signal": [
- {
- "key": "string",
- "value": "string",
- "time": "2019-08-24T14:15:22Z"
}
], - "setting": [
- {
- "key": "string",
- "value": "string",
- "time": "2019-08-24T14:15:22Z"
}
]
}{- "message": "string"
}Used to report back the status of a command. For more details please reference the FAQs
| PROGRAM_PUBLISH_KEY required | string The identifier of the program within Virtual Peaker |
| Authorization required | string^Publish [a-f\d]+$
|
| state required | string Enum: "PENDING" "IN_PROGRESS" "FAILED" "OPT_OUT" "CANCELLED" "COMPLETED" State of the command:
|
| description | string human readable status |
| time required | string <date-time> For more see, RFC 3339, section 5.6. As an example, '2017-07-21T17:32:28Z'. The timezone is always zero UTC offset. |
| refId required | string Command Reference ID |
{- "state": "PENDING",
- "description": "string",
- "time": "2019-08-24T14:15:22Z",
- "refId": "string"
}{- "message": "string"
}Only used if grouping is being used. For more details please reference the FAQs
| PROGRAM_PUBLISH_KEY required | string The identifier of the program within Virtual Peaker |
| Authorization required | string^Publish [a-f\d]+$
|
| state required | string Enum: "PENDING" "IN_PROGRESS" "FAILED" "OPT_OUT" "CANCELLED" "COMPLETED" State of the command:
|
| description | string human readable status |
| time required | string <date-time> For more see, RFC 3339, section 5.6. As an example, '2017-07-21T17:32:28Z'. The timezone is always zero UTC offset. |
| refId required | string Command Reference ID |
| uid required | string DEVICE UID |
{- "state": "PENDING",
- "description": "string",
- "time": "2019-08-24T14:15:22Z",
- "refId": "string",
- "uid": "string"
}{- "message": "string"
}If using OAuth Device Onboarding, devices are assumed to be enrolled when initially discovered.
| PROGRAM_PUBLISH_KEY required | string The identifier of the program within Virtual Peaker |
| Authorization required | string^Publish [a-f\d]+$
|
| state required | string Enum: "enrolled" "unenrolled" |
required | object (DeviceDetails) |
| time required | string <date-time> |
| pairingCode | string Only passed if using Pairing Code Device Discovery. The current format is:
|
{- "state": "enrolled",
- "device": {
- "uid": "string",
- "kind": "HWH",
- "name": "string",
- "type": "string",
- "serialNumber": "string"
}, - "time": "2019-08-24T14:15:22Z",
- "pairingCode": "string"
}{- "message": "string"
}Used for publishing device and site information for in-app enrollment, pre-enrollment from OEM-owned marketplaces, and bulk device enrollment.
| PROGRAM_PUBLISH_KEY required | string The identifier of the program within Virtual Peaker |
| Authorization required | string^Publish [a-f\d]+$
|
| time required | string <date-time> For more see, RFC 3339, section 5.6. As an example, '2017-07-21T17:32:28Z'. The timezone is always zero UTC offset. |
required | Array of objects (DeviceDetails) |
required | object (UserDetails) |
{- "time": "2019-08-24T14:15:22Z",
- "devices": [
- {
- "uid": "string",
- "kind": "HWH",
- "name": "string",
- "type": "string",
- "serialNumber": "string"
}
], - "site": {
- "userId": "string",
- "email": "string",
- "accountNumber": "string",
- "firstName": "string",
- "lastName": "string",
- "serviceAddress": {
- "streetAddress": "string",
- "streetAddress2": "string",
- "city": "string",
- "state": "string",
- "postalCode": "string",
- "country": "string"
}
}
}{- "message": "string"
}