addCommandToCache(params: AddCommandToCacheParams)

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

Description

Add a command (a JSON string of DP key-value pairs) to the cloud cache so it can be delivered to the specified device later. Supports Wi-Fi and ZigBee devices.

Parameters

ParameterTypeRequiredDescription
YesRequest body

Return Value

Type: Promise<boolean>
Operation result; true indicates success. In the documentation, the return parameter is labeled result (boolean).

Examples

Request example

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

const result = await addCommandToCache({
  devId: 'your_device_id',
  dps: JSON.stringify({
    switch_1: true,
  }),
  time: Date.now(),
});

Response example

true