Summarize Energy Consumption Trend of Devices

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

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

API address

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

Request parameter

Parameter nameTypeINRequiredDescription
energy_typeStringuritrueThe energy type. Set the value to electricity.
energy_actionStringquerytrueThe energy behavior. Set the value to consume, representing energy consumption.
statistics_typeStringquerytrueThe 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 last 12 months.
  • 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_timeStringquerytrueThe start time.
end_timeStringquerytrueThe end time.
device_idsStringquerytrueA collection of device IDs.
contain_childsBooleanquerytrueIndicates whether to contain the data of the child nodes. Default value: true.

Return parameter

Parameter nameTypeDescription
resultListThe returned result.

Description of result

Parameter nameTypeDescription
timeStringThe time.
valueFloatThe energy consumption data.
$jacoco_databoolean[]

Request example

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****

Return example

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

Error code

For more information, see error code.