previewLightScene(data: PreviewLightSceneParams)
Requires:
@tuya-miniapp/cloud-api≥1.2.0
Description
Preview the lighting scene effect based on the scene rule JSON data, and return the lists of actions that succeed and fail.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| Yes | Request parameters: ownerId (Home ID), previewExpr (preview scene JSON data that contains the complete scene configuration; see the documentation "previewExpr field description" for PreviewExprData field details) |
Return Value
Type: Promise<PreviewLightSceneResult>
successActions (list of device IDs that executed successfully), failActions (list of device IDs that failed to execute)
Referenced Types
interface
PreviewLightSceneResult| Property | Type | Description |
|---|---|---|
successActions | string[] | List of successfully executed actions |
failActions | string[] | List of failed actions |
Examples
Request example
Response example
Additional notes
- The
previewExprparameter is a JSON string. Build a JavaScript object first, then convert it withJSON.stringify(). - The preview API does not actually run the scene; it only validates configuration correctness and device availability.
- The returned
successActionsandfailActionsarrays contain device IDs, indicating which devices are configured correctly and which may need adjustment. - If all devices are configured correctly,
failActionswill be an empty array.