Summarize Energy Consumption Trend of Devices

Last Updated on : 2023-06-21 07:13:09download

This topic describes the API operations that are used to summarize the energy consumption trend of multiple devices.

API description

Summarize the energy consumption trend of multiple devices within the specified time range.

API endpoint

GET: /v1.0/iot-03/energy/{energy_type}/devices/nodes/statistics-trend

Request parameters

Parameter Type Parameter location Required Description
energy_type String uri true The energy type. Set the value to electricity.
energy_action String query true The energy behavior. Set the value to consume, representing energy consumption.
statistics_type String query true The statistical type. Valid values:
  • month: by month, in the format of yyyyMM. The maximum span is 12 months, and you can only query the data of the most recent year.
  • day: by day, in the format of yyyyMMdd. The maximum span is 7 days, and you can only query the data of the last 90 days.
  • hour: by hour, in the format of yyyyMMddHH. The maximum span is 24 hours, and you can only query the data of the last 7 days.
start_time String query true The start time.
end_time String query true The end time.
device_ids String query true A collection of device IDs.
contain_childs Boolean query true Indicates whether to contain the data of the child nodes. Default value: true.

Return parameters

Parameter Type Description
result List The returned result.

Description of result

Parameter Type Description
time String The time.
value Float The energy consumption data.

Sample request

GET: /v1.0/iot-03/energy/electricity/devices/nodes/statistics-trend?energy_action=consume&statisticsType=day&startTime=20210925&endTime=20210926&containChilds=false&device_ids=6c5ef5dc7fabc34138****,erwerwerwe****

Sample response

    "result": [
            "time": "20210925",
            "value": 0
            "time": "20210926",
            "value": 0
    "t": 1641459342692,
    "success": true

Error codes

For more information, see Global Error Codes.