getSceneRuleDetail(params: GetSceneRuleDetailParams)

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

Description

Query details of a single scene rule

Parameters

ParameterTypeRequiredDescription
YesRequest body (ruleId comes from getSceneListByHomeID or the ruleId returned after saving a scene)

Return Value

Type: Promise<SceneRuleDetail>
SceneRuleDetail (complete details of a single scene rule)

Referenced Types

interfaceSceneRuleDetail`getSceneRuleDetail` returns: full details of a single scene rule
PropertyTypeDescription
Action list
arrowIconUrlstringList arrow icon URL
attributenumberBusiness property flag (as agreed with the cloud)
auditStatusnumberReview status
backgroundstringScene background image URL
boundForPanelbooleanPanel binding
boundForWiFiPanelbooleanWiFi panel binding
categorysstring[]List of scene category tags
codestringScene/rule code
commonFieldstringGeneral extension field (as agreed with the cloud, typically a serialized object such as `{"subMatchType":1}`)
Condition list
containDeviceDeletebooleanWhether flags related to deleted devices are included
coverIconstringIcon URL
descriptionstringScene description
deviceIdsstring[]List of associated device IDs
disableTimenumberDisable-until timestamp (if any, in milliseconds)
displayColorstringBackground color (without the `#` prefix)
enabledbooleanWhether enabled
forceCloudTriggerbooleanWhether to force cloud-side triggering
gmtCreatenumberCreation timestamp (milliseconds)
gmtModifiednumberLast modified timestamp (milliseconds)
idstringScene/Rule ID
iotAutoAlarmbooleanIoT automation alert flags
isAlarmIssuebooleanWhether this is an alert-based linkage
isLogicRulebooleanWhether this is a logic-rule scene
linkageTypenumberLinkage type
localLinkagebooleanWhether this is a local linkage
matchTypenumberMatch type: 1: Any condition; 2: All conditions; 3: Voting-based matching
namestringScene name
needCleanGidSidbooleanWhether to clear associated caches such as gid/sid
needValidOutOfWorkbooleanWhether to validate non-working hours
newLocalScenebooleanWhether the new local scene model is used
offGwSyncbooleanGateway synchronization flag
offGwSyncSuccessbooleanWhether gateway synchronization succeeded
orderWeightnumberList sorting weight
outOfWorknumberStatus flags for non-working hours and other states
ownerIdstringHome ID
panelTypenumberPanel type
permissionCodestringPermission code
roomIdsstring[]List of associated room IDs
ruleGenrenumberRule type: 1: Scene; 2: Automation
ruleSourcenumberRule source channel/system
ruleTypenumberRule source type
1. System-defined 2. Merchant-defined 3. User-defined 4. Security rule 5. Service-defined
runtimeEnvstringRuntime environment (such as `prod`)
scenarioRulebooleanWhether to display in the app's Scenes tab
statusbooleanScene/rule status
statusConditionsunknown[]State-based condition set (structure defined by the cloud)
stickyOnTopbooleanWhether to pin to the top
subMatchTypenumberSub-match type
uidstringUser ID

Examples

Request example

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

getSceneRuleDetail({
  gid: '46718684',
  ruleId: 'rMoXvUMZWDTckvau',
  ruleGenre: 2,        // 1: Scene 2: Automation
  homeModel: true,
})
  .then(detail => {
    console.log('Scene detail:', detail.name);
    // The expr of the timer condition (entityType=6) is an array of objects
    const timer = detail.conditions.find(c => c.entityType === 6);
    console.log('Timer expr:', timer?.expr);
  })
  .catch(error => {
    console.error('Failed:', error);
  });

Response example (excerpt)

{
  "id": "rMoXvUMZWDTckvau",
  "name": "Hehe",
  "ruleGenre": 2,
  "actions": [
    {
      "actionExecutor": "appPushTrigger",
      "actionStrategy": "edge",
      "devDelMark": false,
      "enabled": true
    }
  ],
  "conditions": [
    {
      "entityId": "timer",
      "entitySubIds": "timer",
      "entityType": 6,
      "expr": [
        {
          "date": "20260714",
          "time": "11:28",
          "dayLoops": "229376",
          "monthLoops": "000000100000"
        }
      ],
      "extraInfo": {
        "jumpUrl": "/pages/duration/index"
      }
    }
  ]
}