getStatisticsConfig
Requires:
@tuya-miniapp/cloud-api≥1.0.5
Method signature
getStatisticsConfig(data: )Description
Retrieve the statistics configuration and the DPs enabled for Smart Metering, along with their settings.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| Yes | Request body |
Return Value
Type: Promise<IStatisticsConfig[]>
IStatisticsConfig[] (see type definitions and the minituya return value table for field meanings)
Referenced Types
interface
IStatisticsConfigA single configuration item from `getStatisticsConfig`; consistent with the minituya return table and the example fields in `index`.| Property | Type | Description |
|---|---|---|
algorithmType | "sum" | "avg" | "minux" | "max" | "min" | "count" | "recent" | Statistics type Statistical aggregation algorithm, consistent with the minituya "Statistics Type Description". - `sum`: Sum of reported values within the period, suitable for cumulative quantities. - `minux`: The maximum value in the current period minus the maximum value in the previous period, representing an increment or usage (legacy spelling, not `minus`). - `avg`: Sum of reported values divided by the number of reports, yielding the average. - `min` / `max`: Minimum / maximum value within the period. - `count`: Number of reports within the period. - `recent`: Most recent statistical value. |
dpId | number | string | DP ID with statistics enabled |
productId | string | Product ID |
statisticInterval | number | Statistics interval (consistent with the cloud enumeration): `1` for daily, `2` for hourly, `4` for monthly, and `16` for 15-minute granularity. |
storageDuration | number | Number of days this type of statistical data is retained in the cloud |
Valid Values
IStatisticsConfig.algorithmType
| Value | Description | Since |
|---|---|---|
sum | - | - |
avg | - | - |
minux | - | - |
max | - | - |
min | - | - |
count | - | - |
recent | - | - |