getStatisticsRangDay(data: IGetStatisticsRangDay)

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

Description

Retrieve device statistics for a date range with a daily interval.

Parameters

ParameterTypeRequiredDescription
YesRequest body

Return Value

Type: Promise<IStatisticsData>
IStatisticsData (keys are dates, 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 { getStatisticsRangDay } from '@tuya-miniapp/cloud-api';

getStatisticsRangDay({
  devId: 'vdevo161733425146241',
  dpId: '18',
  startDay: '20230510',
  endDay: '20230511',
  type: 'avg',
})
  .then((response) => {
    console.log(response);
  })
  .catch();

Response example

{
  "20230501": "0",
  "20230502": "0",
  "20230503": "0",
  "20230504": "0",
  "20230505": "0",
  "20230506": "0",
  "20230507": "0",
  "20230508": "0",
  "20230509": "0",
  "20230510": "26.00",
  "20230511": "24.00"
}