Last Updated on : 2024-08-28 07:33:38download
This topic describes APIs related to energy consumption management.
Request method | API endpoint | Description |
---|---|---|
GET | /v1.0/illumination/space/energy/query | Queries energy consumption of a space. |
POST | /v1.0/cloud/illume/open/energy/device | Queries energy consumption of a device. |
API description
Query the energy consumption data of a space over a specific time period.
API endpoint
GET /v1.0/illumination/space/energy/query
Request parameters
Parameter | Data type | Parameter type | Description | Required |
---|---|---|---|---|
projectId | String | Body | The project ID. | Yes |
roomId | String | Body | The space ID. | No |
targetType | Integer | Body | The query type. Valid values:
|
Yes |
startTime | Long | Body | The start time. | Yes |
endTime | Long | Body | The end time. | Yes |
Things to note
targetType
is 1
, the difference between the timestamps must be one day, with one timestamp at 0:00 on one day and the other timestamp at 0:00 on the following day.targetType
is 2
, the difference between the timestamps must be 2 to 31 days. That is, the minimum difference is from 0:00 on one day to 0:00 two days later, while the maximum difference is from 0:00 on the first day of a 31-day month to 0:00 on the first day of the following month.targetType
is 3
, the difference between the timestamps must be within 12 months. That is, the minimum difference is from January to February, while the maximum difference is from one January to the following January, independent of day or hour.Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. It is empty if the request succeeds. For more information, see Error codes. |
success | Boolean | Indicates whether the request succeeds. Valid values:
|
msg | String | The error message. It is empty if the request succeeds. |
t | Long | The returned 13-digit timestamp. |
result | Object | The returned result. |
Description of result
{
"totalEnergy": "double // The total energy consumption.",
"averageEnergy": "double // The average energy consumption.",
"tbValue": "double // The difference between the current period and the previous same period.",
"hbValue": "double // The difference between two consecutive periods.",
"tb": "double // The comparison between the current period and the previous same period.",
"hb": "double // The comparison between two consecutive periods.",
"data": [
{
"sort": "int // The sorting field.",
"time": "long // The timestamp.",
"totalEnergy": "double // The total energy consumption.",
"data": [
{
"purposeCode": "int // The purpose.",
"i18nName": "string // The multilingual name.",
"energy": "double // The energy consumption."
}
]
}
]
}
Sample request
{
"targetType": "The query type. 1 for day, 2 for month, and 3 for year.",
"startTime": "The start time.",
"endTime": "The end time.",
"projectId": "The project ID.",
"roomId": "The space ID."
}
Sample response
{
"totalEnergy": "The total energy consumption.",
"averageEnergy": "The average energy consumption.",
"tbValue": "The difference between the current period and the previous same period.",
"hbValue": "The difference between two consecutive periods.",
"tb": "The comparison between the current period and the previous same period.",
"hb": "The comparison between two consecutive periods.",
"data": [
{
"sort": "The sorting field.",
"time": "The timestamp.",
"totalEnergy": "The total energy consumption.",
"data": [
{
"purposeCode": "The purpose.",
"i18nName": "The multilingual name.",
"energy": "The energy consumption."
}
]
}
]
}
API description
Query the energy consumption data of multiple devices.
API endpoint
POST /v1.0/cloud/illume/open/energy/device
Request parameters
Parameter | Data type | Parameter type | Description | Required |
---|---|---|---|---|
projectId | String | Body | The project ID. | Yes |
deviceIds | String[] | Body | The list of device IDs. | Yes |
period | String | Body | The period. Valid values:
|
|
energyType | Integer | Body | The energy consumption type. Valid values:
|
Yes |
startTime | Long | Body | The start time.
|
Yes |
endTime | Long | Body | The end time.
|
Yes |
Response parameters
Parameter | Type | Description |
---|---|---|
code | Integer | The response code. It is empty if the request succeeds. For more information, see Error codes. |
success | Boolean | Indicates whether the request succeeds. Valid values:
|
msg | String | The error message. It is empty if the request succeeds. |
t | Long | The returned 13-digit timestamp. |
result | Object | The returned result. |
Description of result
{
"totalEnergy": "String // The total energy consumption.",
"averageEnergy": "String // The average energy consumption.",
"energyDetail": [
{
"energy": "String // The energy consumption.",
"theoryEnergy": "String // The theoretical energy consumption.",
"theoryRadio": "String // The theoretical energy consumption ratio.",
"time": "String // The date."
}
]
}
Sample request
{
"projectId": "1793201629403611***",
"deviceIds": [
"6cc4908944f7e67dadg***"
],
"period": "day",
"energyType": "electricity",
"startTime": "20240724",
"endTime": "20240724"
}
Sample response
{
"result": {
"averageEnergy": "0.002",
"energyDetail": [
{
"energy": "0.002",
"theoryEnergy": "0.012",
"theoryRadio": "0.857",
"time": 2024072400
},
{
"energy": "0.000",
"theoryEnergy": "--",
"theoryRadio": "--",
"time": 2024072416
}
],
"totalEnergy": "0.028"
},
"success": true,
"t": 1721807661231,
"tid": "ef604ae2499111efb454526982c4e3fa"
}
The following table lists the error codes that might be returned when you call these APIs. For more information, see Global Error Codes.
Error code | Description |
---|---|
500 | A system error occurred. |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback