---
name: "getSceneListByHomeID"
mode: "api"
versionRequirements:
  - { name: "@tuya-miniapp/cloud-api", version: "1.1.0" }
---

## getSceneListByHomeID

> [VERSION] @tuya-miniapp/cloud-api >= 1.1.0

> 💡 This API depends on cloud capabilities. Configure authorization in Development Settings - Cloud Capabilities on the [Mini App Developer Platform](https://platform.tuya.com/miniapp/).
> Note: The response example is for reference only and includes fields beyond the defined response parameters. Do not use any response data other than what is defined here, otherwise it may cause application errors.

### Description

Get the list of one-tap execution and automation scenes for a home

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `params` | `GetSceneListByHomeIDParams` | Yes | Request body |

### Return Value

Type: `Promise<Scene[]>`

GetSceneListByHomeIDResult (see type definitions and minituya return parameters for field meanings)

##### Scene

| Property | Type | Description |
| --- | --- | --- |
| `actions` | `Action[]` | Action list |
| `arrowIconUrl` | `string` | List arrow icon URL |
| `attribute` | `number` | Business attribute marker (as agreed with the cloud) |
| `auditStatus` | `number` | Review status |
| `background` | `string` | Scene background image URL |
| `boundForPanel` | `boolean` | Panel binding |
| `boundForWiFiPanel` | `boolean` | Wi-Fi panel binding |
| `categorys` | `string[]` | List of scene category tags |
| `code` | `string` | Scene/rule code |
| `commonField` | `string` | General extension fields (as agreed with the cloud) |
| `conditions` | `Condition[]` | Condition list; one-tap execution has no conditions |
| `containDeviceDelete` | `boolean` | Whether to include markers related to deleted devices |
| `coverIcon` | `string` | Icon |
| `description` | `string` | Scene description |
| `deviceIds` | `string[]` | Associated device ID list |
| `disableTime` | `number` | Disable-until timestamp (if any) |
| `displayColor` | `string` | Background color |
| `enabled` | `boolean` | Whether enabled |
| `forceCloudTrigger` | `boolean` | Whether to force cloud trigger |
| `gmtCreate` | `number` | Creation timestamp |
| `gmtModified` | `number` | Last modified timestamp |
| `id` | `string` | Scene ID |
| `iotAutoAlarm` | `boolean` | IoT automation alert flag |
| `isAlarmIssue` | `boolean` | Whether it's an alert-type linkage |
| `isLogicRule` | `boolean` | Whether it's a logic-rule scene |
| `linkageType` | `number` | Linkage type |
| `localLinkage` | `boolean` | Whether it's a local linkage |
| `logicRule` | `boolean` | Whether it's a logic rule (mapped to the cloud field) |
| `matchType` | `number` | Match type 1. Any condition: triggers if any condition is met (OR). 2. All conditions: triggers only if all conditions are met. 3. Expression matching: based on the expr field in rule; triggers when the expression is satisfied. |
| `name` | `string` | Scene name |
| `needCleanGidSid` | `boolean` | Whether to clear related caches such as gid/sid |
| `needValidOutOfWork` | `boolean` | Whether to validate non-working hours |
| `newLocalScene` | `boolean` | Whether it's the new local scene model |
| `offGwSync` | `boolean` | Gateway sync flag |
| `offGwSyncSuccess` | `boolean` | Whether gateway sync has succeeded |
| `orderWeight` | `number` | List sort weight |
| `outOfWork` | `number` | Off-hours and other status flags |
| `ownerId` | `string` | Home ID |
| `panelType` | `number` | Panel type |
| `permissionCode` | `string` | Permission code |
| `ruleGenre` | `number` | Rule type: 1 - Scene, 2 - Automation |
| `ruleSource` | `number` | Rule source channel/system |
| `ruleType` | `number` | Rule type 1. System-defined 2. Merchant-defined 3. User-defined 4. Security rule 5. Service-defined (e.g., DP point forwarding) |
| `runtimeEnv` | `string` | Runtime environment |
| `scenarioRule` | `boolean` | Whether to display in the APP Scene tab |
| `status` | `boolean` | Scene/Rule status |
| `statusConditions` | `unknown[]` | State-based condition set (structure defined by the cloud) |
| `stickyOnTop` | `boolean` | Whether to pin to top |
| `subMatchType` | `number` | Sub-match type (granular strategy when used with `matchType`) |
| `uid` | `string` | User ID |

### Referenced Types

##### `interface` GetSceneListByHomeIDParams

| Property | Type | Description |
| --- | --- | --- |
| `gid` | `string` | Home ID |

##### `interface` Action

| Property | Type | Description |
| --- | --- | --- |
| `actionExecutor` | `string` | Action executor |
| `actionStrategy` | `string` | Action execution strategy |
| `attribute` | `number` | Property value |
| `defaultIconUrl` | `string` | Default icon URL |
| `devDelMark` | `boolean` | If the current condition is of device type, this field indicates whether the associated device has been removed |
| `enabled` | `boolean` | Whether the action is enabled |
| `entityId` | `string` | Entity ID indicating the entity the action belongs to |
| `executorProperty` | `Record<string, string \| number \| false \| true>` | Action execution information |
| `executorPropertyKeyOrder` | `string[]` | Display/dispatch order of keys within `executorProperty` |
| `extraProperty` | `Record<string, unknown>` | Additional information |
| `gmtModified` | `number` | Modification timestamp |
| `id` | `string` | Unique ID of the action |
| `offGwSync` | `boolean` | Gateway sync flag indicating whether gateway synchronization is enabled |
| `orderNum` | `number` | Action sequence number |
| `ruleId` | `string` | Rule ID indicating the rule the action belongs to |
| `status` | `boolean` | Action status |
| `uid` | `string` | User ID indicating the user the action belongs to |

##### `interface` Condition

| Property | Type | Description |
| --- | --- | --- |
| `attribute` | `number` | Property value |
| `condType` | `number` | Condition type |
| `defaultIconUrl` | `string` | Default icon URL |
| `devDelMark` | `boolean` | If the current condition is of device type, this field indicates whether the associated device has been removed |
| `enabled` | `boolean` | Whether the condition is enabled |
| `entityId` | `string` | Entity ID indicating the entity the condition belongs to |
| `entitySubIds` | `string` | List of child entity IDs associated with the condition (e.g., multi-DP combination) |
| `entityType` | `number` | Condition type |
| `expr` | `string \| number[][]` | Condition expression |
| `extraInfo` | `Record<string, unknown>` | Additional information |
| `handleStrategy` | `string` | Identifier of the processing strategy when the condition is matched |
| `iconUrl` | `string` | Icon URL |
| `id` | `string` | Condition ID, indicating the ID of the condition |
| `orderNum` | `number` | Order of the condition within the rule |
| `ruleId` | `string` | Automation ID indicating the automation the condition belongs to |
| `serviceProvider` | `string` | Service provider identifier |
| `support` | `number` | Capability/service support bit flag (agreed with the cloud) |


### Examples

#### Request example

```typescript
import { getSceneListByHomeID } from '@tuya-miniapp/cloud-api';

getSceneListByHomeID({
  gid: '123456789',
})
  .then(response => {
    console.log(response);
  })
  .catch(error => {
    console.error('Failed to get scene list:', error);
  });
```

#### Response example

```json
[
  {
    "id": "scene_001",
    "name": "Home mode",
    "coverIcon": "https://example.com/icon.png",
    "description": "Automatically turn on the lights when you arrive home",
    "displayColor": "6559D1",
    "enabled": true,
    "matchType": 1,
    "ruleGenre": 2,
    "ruleType": 3,
    "runtimeEnv": "prod",
    "scenarioRule": true,
    "actions": [
      {
        "id": "action_001",
        "actionExecutor": "dpIssue",
        "actionStrategy": "edge",
        "attribute": 3,
        "defaultIconUrl": "https://example.com/icon.png",
        "deleteDevIcon": "https://example.com/icon.png",
        "devDelMark": true,
        "enabled": true,
        "entityId": "device_001",
        "executorProperty": {
          "28": 18
        },
        "executorPropertyKeyOrder": [
          "28"
        ],
        "extraProperty": {
          "dpScale": 0,
          "path": "/pages/device/detail/index"
        },
        "gmtModified": 1699200000000,
        "offGwSync": false,
        "orderNum": 1,
        "ruleId": "scene_001",
        "status": false,
        "uid": "user_001"
      }
    ],
    "conditions": [
      {
        "id": "condition_001",
        "attribute": 3,
        "condType": 1,
        "defaultIconUrl": "https://example.com/icon.png",
        "deleteDevIcon": "https://example.com/icon.png",
        "devDelMark": true,
        "enabled": true,
        "entityId": "device_002",
        "entitySubIds": "1",
        "entityType": 1,
        "expr": [
          [
            "$dp1",
            "==",
            "disarmed"
          ]
        ],
        "extraInfo": {},
        "handleStrategy": "",
        "iconUrl": "https://example.com/icon.png",
        "orderNum": 1,
        "ruleId": "scene_001",
        "serviceProvider": "",
        "support": 0
      }
    ],
    "arrowIconUrl": "https://example.com/arrow.png",
    "attribute": 4,
    "auditStatus": 0,
    "background": "",
    "boundForPanel": false,
    "boundForWiFiPanel": false,
    "categorys": [
      "home",
      "light"
    ],
    "code": "",
    "commonField": "{\"subMatchType\":1}",
    "containDeviceDelete": false,
    "deviceIds": [
      "device_001",
      "device_002"
    ],
    "disableTime": 0,
    "forceCloudTrigger": false,
    "gmtCreate": 1699200000000,
    "gmtModified": 1699200000000,
    "iotAutoAlarm": false,
    "isAlarmIssue": false,
    "isLogicRule": false,
    "linkageType": 0,
    "localLinkage": false,
    "needCleanGidSid": false,
    "needValidOutOfWork": false,
    "newLocalScene": false,
    "offGwSync": false,
    "offGwSyncSuccess": false,
    "orderWeight": 1,
    "outOfWork": 0,
    "ownerId": "123456789",
    "panelType": 0,
    "permissionCode": "",
    "ruleSource": 0,
    "status": true,
    "statusConditions": [],
    "stickyOnTop": true,
    "subMatchType": 1,
    "uid": "user_001"
  }
]
```
