- Device API
- Cloud API
- Application API
- Set up and Account Management
- User notification
- Device types
- Device Activation
- Consumer Mapping
- Post device to consumer mapping
- Update consumers
- Delete consumer
- Set device attributes
- Set device property
- Get device properties
- Delete device property
- Set consumer property
- Get consumer properties
- Delete consumer property
- Create/edit consumer make
- Delete consumer make
- Create/edit consumer model
- Delete consumer model
- Monitoring
- Get devices Info
- Get location current total energy usage
- Get location current power consumption
- Get projection for location
- Get aggregated location energy usage
- Get device current total energy usage
- Get aggregated device level energy usage
- Device instantaneous readings history
- Last N history records
- Get current device parameters
- Get real time device readings
- Control
- Rules
- Analytic Rules
- Compare
- Quiz
- Market
- Analytics and Admin API
- Downloads
- Account
You are here
Device API
JSON format of API
In addition to described XML format of the deviceserver communication protocol People Power Company supports JSON version of this API. As the device IO API has been already explained in details with examples in XML format, JSON object members will be described in comparison to XML tags and attributes.
To use it the device must post data in JSON format to /deviceio/mljson URI. In this case the server will response in JSON format as well.
Device input message object
| Member | Type | Definition | XML tag or attribute |
|---|---|---|---|
| version or ver | string | Protocol version | ver attribute of the h2s tag |
| proxyId or hubId | string | gateway ID | hubId attribute of the h2s tag |
| sequenceNumber or seq | string | message sequence number | seq attribute of the h2s tag |
| measures | array of measured data | measured data (see below) | measure tag |
| addDevices | array of device definitions | new devices to be registered on the server | add tag |
| responses | array of command responses | device responses to server commands | response tag |
| alerts | array of device alerts | device alerts | alert tag |
Measured data object
One of timestamp or dateTime fields should be set. Otherwise measure time will be set to time, when the input message has been received.
| Member | Type | Definition | XML tag or attribute |
|---|---|---|---|
| deviceId | string | device ID | deviceId attribute of the measure tag |
| timestamp | number | time in milliseconds since Unix epoch (optional) | time attribute of the measure tag |
| dateTime | string | date and time in xsd:dateTime format (optional) | timestamp attribute of the measure tag |
| params | array of parameters | measured or static device parameters | param tag |
Device parameter object
| Member | Type | Definition | XML tag or attribute |
|---|---|---|---|
| name | string | parameter name | name attribute of the param tag |
| index | string | individual sense point index (optional) | index attribute of the param tag |
| value | string | parameter value | value of the param tag |
| durational | true | false | Flag if this is a durational value as a difference since the last upload time (optional, default is false) | durational attribute of the param tag |
| unit | string | Value unit like watt, Wh, second (optional, default is system unit for this parameter name) | unit attribute of the param tag |
| multiplier | string | Value multiplier (optional, default is system multiplier for this parameter name) | multiplier attribute of the param tag |
Device definition object
| Member | Type | Definition | XML tag or attribute |
|---|---|---|---|
| deviceId | string | device ID | deviceId attribute of the add tag |
| deviceType | number | device type | deviceType attribute of the add tag |
| params | array of device parameters | parameters used in device registration | param tag |
Command response object
| Member | Type | Definition | XML tag or attribute |
|---|---|---|---|
| commandId | number | command ID | cmdId attribute of the response tag |
| result | number | result code | result attribute of the response tag |
Device alert object
| Member | Type | Definition | XML tag or attribute |
|---|---|---|---|
| deviceId | string | device ID | deviceId attribute of the add tag |
| alertType | string | alert type | type attribute of the alert tag |
| params | array of alert parameters | alert parameters | param tag |
Example:{"version":"2","proxyId":"0123456ABCDEF","seq":"123",
"measures":[
{"deviceId":"0123456ABCDEF","dateTime":"2012-02-06T17:24:35-05:00","params":[
{"name":"energy","index":"0","value":"0.123",
"durational":true,"unit":"Wh","multiplier":"k"},
{"name":"power","index":"1","value":"100"}
]}
],
"addDevices":[
{"deviceId":"0123456FEDCBA","deviceType":6,
"params":[{"name":"domainName","value":"ppc.com"}]
}
],
"responses":[{"commandId":10,"result":1}],
"alerts":[
{"deviceId":"0123456FEDCBA","alertType":"LAUNDRY_DONE",
"params":[{"name":"time","value":"1800"}]
}
]
}
Server response message object
| Member | Type | Definition | XML tag or attribute |
|---|---|---|---|
| version | string | protocol version | ver attribute of the s2h tag |
| seq | string | response sequence number | seq attribute of the s2h tag |
| status | string | response status | status attribute of the s2h tag |
| commands | array of commands | server commands | command tag |
| unknown | array of strings | not recognized device ID's | unknown tag |
Command object
| Member | Type | Definition | XML tag or attribute |
|---|---|---|---|
| type | number | command type: 0 - set, 1 - delete | type attribute of the command tag |
| commandId | number | command ID | cmdId attribute of the command tag |
| deviceId | string | device ID | deviceId attribute of the command tag |
| parameters | array of command parameters | parameters of the command | param tag |
Command parameter object
| Member | Type | Definition | XML tag or attribute |
|---|---|---|---|
| name | string | parameter name | name attribute of the param tag |
| index | string | individual sense point index (optional) | index attribute of the param tag |
| value | string | parameter value | value of the param tag |
Example:{"version":"2","seq":"SeqNum","status":"ACK",
"commands":[{"type":0,"commandId":456,"deviceId":"B0C8ADFFFE000001",
"parameters":[{"name":"outletStatus","index":"1","value":"ON"}]}],
"unknown":["B0C8ADFFFE000002","B0C8ADFFFE000003"]}