Query Total Energy Consumption of Devices

Last Updated on : 2022-01-13 10:10:05

Query the total energy consumption data of multiple devices within a specified time range, including the usage, generation, or dump analysis statistics regarding water, electricity, and natural gas.

API address

GET: /v1.0/iot-03/energy/{energy_type}/device/nodes/statistics-sum

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.
contain_childsBooleanquerytrueIndicates whether to contain the data of the child nodes. Default value: true.
device_idsStringquerytrueThe list of device IDs to be included in the statistics.

Return parameter

Parameter nameTypeDescription
resultFloatThe statistical result. Unit: kWh.

Request example

GET: /v1.0/iot-03/energy/electricity/device/nodes/statistics-sum?energy_action=consume&statisticsType=day&startTime=20210925&endTime=20210926&containChilds=false&device_ids=147355207358382****,147355203680817****

Return example

    "result": 40,
    "t": 1641439262706,
    "success": true

Error code

For more information, see error code.