getStatisticsRangMonth(data: IGetStatisticsRangMonth)

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

Description

Get device statistics over a date range with month as the interval.

Parameters

ParameterTypeRequiredDescription
YesRequest body

Return Value

Type: Promise<IStatisticsData>
IStatisticsData (keys are months, etc.; see the response example 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 { getStatisticsRangMonth } from '@tuya-miniapp/cloud-api';

getStatisticsRangMonth({
  devId: 'vdevo161733425146241',
  dpId: '18',
  startMonth: '202304',
  endMonth: '202305',
  type: 'avg',
})
  .then((response) => {
    console.log(response);
  })
  .catch();

Response example

{
  "202304": "0",
  "202305": "24.00"
}