getStatisticsRangHour(data: IGetStatisticsRang)

Requires:
@tuya-miniapp/cloud-api≥1.0.5

Description

With an hourly interval, retrieve the device's statistics for the date range.

Parameters

ParameterTypeRequiredDescription
YesRequest body

Return Value

Type: Promise<IStatisticsData>
IStatisticsData (keys are hourly granularity, etc.; see the sample response in the docs)

Referenced Types

typeIStatisticsDataFlattened data from interval statistics APIs: keys are time slices (e.g., 15-min buckets, hour, day, month; format varies by API), values are statistical result strings; missing data may be placeholders such as `'#'` (see the response examples of each API).
Record<string, string>

Valid Values

ICommonGetStatisticsRang.type
ValueDescriptionSince
sum--
avg--
minux--
max--
min--
count--
recent--

Examples

Request example

import { getStatisticsRangHour } from '@tuya-miniapp/cloud-api';

getStatisticsRangHour({
  devId: 'vdevo161733425146241',
  dpId: '18',
  date: '20230511',
  type: 'avg',
})
  .then((response) => {
    console.log(response);
  })
  .catch();

Response example

{
  "2023051117": "0.00",
  "2023051118": "24.00",
  "2023051119": "0.00",
  "...": "..."
}