Query Energy Consumption Trend in Space

Last Updated on : 2021-09-30 09:24:05download

Query energy trend data in a space within a specified time range, including the usage, generation, or dump statistics regarding water, electricity, and natural gas.

API address

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

Request parameter

Parameter name Type IN 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 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_time String query true The start time.
end_time String query true The end time.
depth Integer query false The level of a specified space. Default value: 0, indicating the first level in the space. The value range is 0 to 9.
contain_childs Boolean query false Indicates whether to contain the data of the child nodes. Default value: true.

Return parameter

Parameter name Type Description
result List

Description of result

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

Request example

GET: /v1.0/iot-03/energy/electricity/space/statistics-trend?energy_action=consume&statisticsType=hour&startTime=2021092315&endTime=2021092318&depth=0&containChilds=false

Return example

{ "result": [ { "time": "2021092315", "value": 0 }, { "time": "2021092316", "value": 24.1 }, { "time": "2021092317", "value": 20.2 }, { "time": "2021092318", "value": 0 } ], "t": 1632465822576, "success": true }

Error code

For more information, see error code.