On this page

getAnalyticsLogsStatusLog(data: GetAnalyticsLogsParams)

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

Description

Get historical reported logs within a time range

Parameters

ParameterTypeRequiredDescription
YesRequest body

Return Value

Type: Promise<GetAnalyticsLogsResult>
Includes dps (device DP data collection), hasNext (whether there is a next page), and total (total record count); each dps element is DpResult

Referenced Types

typeGetAnalyticsLogsResultPaginated log results. The response examples also include a `dpc` field that is not individually documented in the return parameter table.
PropertyTypeDescription
dpsDpResult[]Device DP data collection
hasNextbooleanWhether there is a next page of data
totalnumberTotal record count

Examples

Request example

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

getAnalyticsLogsStatusLog({
  devId: 'tuya1319563f96bc263b',
  dpIds: '103',
  offset: 0,
  limit: 10,
})
  .then((response) => {
    console.log(response);
  })
  .catch();

Response example

{
  "dpc": [],
  "dps": [
    {
      "dpId": "1, 103",
      "timeStamp": 1696845110,
      "timeStr": "2023-10-09 17:51:50",
      "value": "180"
    },
    {
      "dpId": "1, 103",
      "timeStamp": 1696845111,
      "timeStr": "2023-10-09 17:51:51",
      "value": "180"
    },
    {
      "dpId": "1, 103",
      "timeStamp": 1696845112,
      "timeStr": "2023-10-09 17:51:52",
      "value": "180"
    }
  ],
  "hasNext": false,
  "total": 3
}

Notes

  1. This API is a cloud capability and must be authorized before use. For details, see the cloud capability documentation. Cloud capabilities are not available in the Developer Tools environment; package the MiniApp or test on a real device.
  2. To upgrade device log storage and unlock more features, visit Device log value-added service. After upgrading, follow the activation process after subscribing to device log storage. With upgraded storage, this API can retrieve more logs.
  3. If the dpValue you query is a numeric DP, convert it using the numeric DP scale (data is transmitted as a power of 10; for example, if scale is 1, divide by 10). If the raw value is 343701 and scale is 1, pass 34370.1 in dpValues.