This service provides a set of APIs for clients to create and configure automated scenarios. These APIs let you execute tasks when specific conditions are met, such as automatically turning on a device at a scheduled time.
Scene rule descriptions
Create, edit, delete, and query scenarios
- Create a scenario or automation
- Update a scenario or automation
- Delete a scenario or automation
- View the details of a scenario or automation
- View the details of multiple scenarios or automations in a batch
- Query a list of scenarios or automations
- Query lists of scenarios and automations at the same time
- Change the sort order of a scenario list
- Retrieve a list of feature properties that support trigger, condition, or action configurations for a device
- Retrieve a list of devices that support trigger, condition, or action configurations
- Retrieve the trigger, condition, and action features and the TSL definition of a device
- Push a message to a mobile phone
- Execute a scenario
- Enable or disable a scenario
- Retrieve a list of scenario logs
- View the details of a failed log
Scene rule descriptions
A scene rule describes what triggers an action (Trigger), what conditions must be met (Condition), and what action to execute (Action). Two rule formats are supported: If This Then That (IFTTT) and Condition & Action (CA). IFTTT supports Trigger, Condition, and Action nodes. CA is a simplified version of IFTTT that combines the Trigger and Condition into a single "condition".
IFTTT rules
The following example shows a typical scene rule. The scenario is triggered (Trigger) when the someone_exist property of the device `sensor_01` is equal to 1. The system then checks if the current time is between 06:00 and 22:00 (Condition). If it is, the switch property of the `light` device is set to on (Action).
{
"type":"IFTTT",
"trigger":{
"uri":"trigger/device/property",
"params":{
"iotId":"sensor_01_iotId",
"propertyName":"someone_exist",
"compareType":"==",
"compareValue":1
}
},
"condition":{
"uri":"logical/and",
"items":[
{
"params":{
"cron":"0-0 6-22 * * 1,2,3",
"cronType":"linux",
"timezoneID":"Shanghai"
},
"uri":"condition/timeRange"
}
]
},
"action":[
{
"uri":"action/device/setProperty",
"params":{
"iotId":"light_iotId",
"propertyName":"onOff",
"propertyValue":"on"
}
}
]
}The preceding example shows an IFTTT scene rule. The rule includes the following four nodes:
| Name | Description |
| type | The type of the scene rule. Valid values are IFTTT and CA. |
| trigger | The trigger for the scenario, such as a specific time or a device property. A scenario can have multiple triggers. These triggers have an "OR" relationship. A scenario can also have no triggers. In this case, you can manually trigger the scenario by calling an API. |
| condition | The filter condition after the scenario is triggered, such as a time range or a device property. A scenario can have multiple filter conditions. These conditions have an "AND" relationship. A scenario can also have no filter conditions. In this case, the corresponding actions are executed directly after the scenario is triggered. |
| action | The action to execute when the scenario is triggered and the filter conditions are met. Examples include setting a device property or triggering another scenario. A scenario can have multiple actions. A scenario must have at least one action. |
The following example shows a scene rule with multiple triggers and multiple conditions. The logical/or node encapsulates multiple triggers, and the logical/and node encapsulates multiple conditions.
{
"type":"IFTTT",
"trigger":{
"uri":"logical/or",
"items":[
{
"uri":"trigger/device/property",
"params":{
"productKey":"pk_sensor",
"deviceName":"sensor_01",
"propertyName":"someone_exist",
"compareType":"==",
"compareValue":1
}
},
{
"uri":"trigger/timer",
"params":{
"cron":"0 0 10 * *",
"cronType":"linux"
}
}
]
},
"condition":{
"uri":"logical/and",
"items":[
{
"uri":"condition/device/property",
"params":{
"productKey":"pkxxxxon",
"deviceName":"txxxxce",
"propertyName":"soxxxxrty",
"compareType":"<",
"compareValue":10
}
},
{
"params":{
"cron":"0-0 9-12 * * 1,2,3",
"cronType":"linux",
"timezoneID":"Asia/Shanghai"
},
"uri":"condition/timeRange"
}
]
},
"action":[
{
"uri":"action/device/setProperty",
"params":{
"productKey":"pk_action",
"deviceName":"test_device",
"propertyName":"onOff",
"propertyValue": "on"
}
},
{
"uri":"action/scene/trigger",
"params":{
"automationRuleId":"some_scene_id"
}
}
]
}The preceding rule means that the scenario is triggered at 10:00 every day or when the `someone_exist` property of the device `sensor_01` is equal to 1. If the `some_property` of the device `test_device` is less than 10 and the current time is between 09:00 and 12:00, the actions are executed. The `onOff` property of `test_device` is set to `on`, and another scenario is triggered.
CA rules
In addition to IFTTT rules, CA rules are also supported. A CA rule is a simplified version of an IFTTT rule. It includes `type`, `mode`, `condition`, and `action` nodes.
| Name | Description |
| type | The type of the scene rule. Valid values are IFTTT and CA. |
| mode | The mode of the CA rule. Valid values are `any`, which means the action is executed if any condition is met, and `all`, which means the action is executed only when all conditions are met. |
| condition | The trigger conditions for the scenario, such as a specific time, a device property, or a time range. A scenario can have multiple trigger conditions. |
| action | The action to execute when the scenario is triggered. Examples include setting a device property or triggering another scenario. A scenario can have multiple actions. A scenario must have at least one action. |
The following is an example of a CA scene rule.
{
"type":"CA",
"mode":"all",
"condition":[
{
"uri":"condition/device/property",
"params":{
"productKey":"pk_condition",
"deviceName":"sensor_01",
"propertyName":"some_property",
"compareType":">",
"compareValue":"300"
}
},
{
"uri":"condition/device/property",
"params":{
"productKey":"pk_condition",
"deviceName":"sensor_02",
"propertyName":"BarrierState",
"compareType":"in",
"compareValue":[
0,
1,
2
]
}
},
{
"uri":"condition/timer",
"params":{
"cron":"0 05 10 * *",
"cronType":"linux"
}
}
],
"action":[
{
"uri":"action/device/setProperty",
"params":{
"productKey":"pk_action",
"deviceName":"test_device",
"propertyName":"LightStatus",
"propertyValue": 1
}
}
]
}The preceding rule means that if the `some_property` of the device `sensor_01` is greater than 300, the `BarrierState` property of the device `sensor_02` is 0, 1, or 2, and the time is 10:05, the `LightStatus` property of the device `test_device` is set to 1.
Trigger components
The supported Trigger components include the following:
| URL | Description | |
| trigger/timer | Scheduled trigger | |
| trigger/device/property | Device property trigger | |
| trigger/device/event | Device event trigger |
trigger/timer parameter descriptions
| Parameter | Type | Description | Reference |
| cron | String | Cron expression | Cron expression format: http://crontab.org/ |
| cronType | String | The expression type. Valid values are `linux` and `quartz_cron`. `linux`: A 5-field crontab expression. The year cannot be set. `quartz_cron`: A 7-field Quartz cron expression. The year is supported. Currently, the minimum precision is minutes. The first field for seconds must be `0`. | Cron expression format: http://crontab.org/ |
| timezoneID | String | The time zone ID. This parameter is optional. It specifies the time zone for the cron expression. If you do not set this parameter, the time zone of the region where the IoT Platform service is located is used by default. We recommend that you set this parameter to specify a time zone. | Example: Asia/Shanghai |
Cron expression types and examples
| Expression type | Expression structure | Expression fields | Expression example |
| linux | ${minute} ${hour} ${day of month} ${month} ${day of week} |
| 1 3 * * *Note Triggers at 03:01 every day. |
| quartz_cron | ${second} ${minute} ${hour} ${day of month} ${month} ${day of week} ${year}Note Past times that cannot be reached are not allowed. |
| 0 * 14 * * ? 2019 Note Triggers every minute from 14:00 to 14:59 every day in 2019. |
trigger/timer example
{
"uri":"trigger/timer",
"params":{
"cron":"* * * * *",
"cronType":"linux",
"timezoneID":"Asia/Shanghai"
}
}trigger/device/property parameter descriptions
| Parameter | Type | Description |
| productKey | String | ProductKey |
| deviceName | String | Device Name |
| propertyName | String | The name of the device property to compare. |
| compareType | String | The comparison type, such as >, <, >=, ==, <=, !=, in, or like. |
| compareValue | Object | The value to compare. |
trigger/device/property example
{
"uri":"trigger/device/property",
"params":{
"productKey":"test_pk",
"deviceName":"test_dn",
"propertyName":"temp",
"compareType":">",
"compareValue":30
}
}trigger/device/event parameter descriptions
| Parameter | Type | Description | |
| productKey | String | The ProductKey of the device. | |
| deviceName | String | The name of the device. | |
| eventCode | String | The event code of the device. This parameter is optional. | |
| propertyName | String | The name of the device property. | |
| compareType | String | The comparison type, such as >, <, >=, ==, <=, !=, in, or like. | |
| compareValue | Object | The value to compare. |
trigger/device/event example
{
"uri":"trigger/device/event",
"params":{
"productKey":"test_pk",
"deviceName":"test_dn",
"eventCode":"temp_warning",
"propertyName":"temp",
"compareType":">",
"compareValue":30
}
}Condition components
The supported Condition components include the following:
| URL | Description Logic |
| condition/timeRange | Compares whether the current time is within a specific range. |
| condition/device/property | Device property filter. |
condition/timeRange parameter descriptions
| Parameter | Type | Description |
| cron | String | `20-25 11-23 * * 1,2,3` indicates that the action is allowed to be executed from 11:20 to 23:25 on Monday, Tuesday, and Wednesday of every week. |
| cronType | String | The cron expression type. The value is `linux`. |
| timezoneID | String | Example: Asia/Shanghai |
condition/timeRange example
{
"params":{
"cron":"0-0 9-12 * * 1,2,3",
"cronType":"linux",
"timezoneID":"Asia/Shanghai"
},
"uri":"condition/timeRange"
}condition/device/property parameter descriptions
| Parameter | Type | Description |
| productKey | String | The ProductKey of the device. |
| deviceName | String | The name of the device. |
| propertyName | String | Device property. |
| compareType | String | The comparison type, such as >, <, >=, ==, <=, !=, in, or like. |
| compareValue | Object | Comparison value. |
condition/device/property example
{
"uri":"condition/device/property",
"params":{
"productKey":"test_product",
"deviceName":"test_device",
"propertyName":"temp",
"compareType":">",
"compareValue":30
}
}Action components
The supported Action components include the following:
| URL | Description |
| action/device/setProperty | Set a device property. |
| action/device/invokeService | Call a device service. |
| action/scene/trigger | Trigger another scenario. If the triggered scenario contains a condition and the condition is not met, the action of the triggered scenario is not executed. |
| action/automation/setSwitch | Enable or disable another scenario. |
action/scene/trigger parameter descriptions
| Parameter | Type | Description | Example | |
| sceneId | String | The scenario ID. | None |
action/scene/trigger example
{
"uri":"action/scene/trigger",
"params":{
"sceneId":"xxx"
}
}action/device/invokeService parameter descriptions
| Parameter | Type | Description | Example | |
| iotId | String | The device ID. | None | |
| serviceName | String | The service name. | None | |
| serviceArgs | JSON | The service parameters. | {"warningStatus":"off","level":"init"} |
action/device/invokeService example
{
"uri":"action/device/invokeService",
"params":{
"iotId":"xxxx",
"serviceName":"clearWarningStatus",
"serviceArgs":{
"warningStatus":"off",
"level":"init"
}
}
}action/device/setProperty parameter descriptions
| Parameter | Type | Description | Example |
| iotId | String | The device ID. | None |
| propertyName | String | The name of the property to set. | PowerSwitch |
| propertyValue | Object | The value of the property to set. | 1 |
| delayedExecutionSeconds | Integer | The delayed execution time. This parameter is optional. By default, the action is executed immediately. If you set this parameter, the action is executed after the specified delay. Unit: seconds. The value must be between 1 and 86400 (24 hours). | 10 |
action/device/setProperty example
{
"uri":"action/device/setProperty",
"params":{
"iotId":"xxxx",
"propertyName":"PowerSwitch",
"propertyValue":1,
"delayedExecutionSeconds":10
}
}action/automation/setSwitch parameter descriptions
| Parameter | Type | Description | Example |
| automationRuleId | String | The ID of the scenario to enable or disable. | None |
| switchStatus | Integer | `0` indicates disable, and `1` indicates enable. | 1 |
action/automation/setSwitch example
{
"uri":"action/automation/setSwitch",
"params":{
"automationRuleId":"xxxx",
"switchStatus":0
}
}CaCondition components
The supported CaCondition components include the following:
| URL | Description Logic |
| condition/timer | Timer. The function and parameters are the same as the `trigger/timer` component in IFTTT rules. |
| condition/timeRange | Time range. The function is the same as `condition/timeRange` in IFTTT rules. It can only be used in `all` mode and is ignored in `any` mode. Note The parameter format of the `condition/timeRange` node in CA rules is different from that in IFTTT rules. |
| condition/device/property | Device property. The function and parameters are the same as `trigger/device/property` in IFTTT rules. |
condition/timeRange parameter descriptions
| Parameter | Type | Description |
| format | String | The time format, such as `HH:mm`. |
| timezoneID | String | The time zone ID. This parameter is optional. It specifies the time zone for the time range check. If you do not set this parameter, the time zone of the region where the IoT Platform service is located is used by default. We recommend that you set this parameter to specify a time zone. |
| beginDate | String | The start time. The format must match the one specified by `format`. For example, if `format` is `HH:mm`, you can set `beginDate` to `12:30`. |
| endDate | String | The end time. The format must match the one specified by `format`. For example, if `format` is `HH:mm`, you can set `endDate` to `13:30`. Note If `beginDate` is later than `endDate`, the time range spans across midnight. For example, if `beginDate` is `22:00` and `endDate` is `06:00`, the time range is from 22:00 to 06:00 the next day. |
| repeat | String | The days of the week for repetition. This is a string of comma-separated numbers from 1 to 7. This parameter is optional. If you do not set it, the action does not repeat. For example, `1,2,3` indicates that the action repeats on Monday, Tuesday, and Wednesday. |
condition/timeRange format value descriptions
| Value | Description |
| mm:ss | Minutes and seconds |
| HH:mm | Hour:Minute |
| HH:mm:ss | Hour:Minute:Second |
| dd HH | Day:Hour |
| dd HH:mm | Day:Hour:Minute |
| dd HH:mm:ss | Day:Hour:Minute:Second |
| MM | Month |
| MM-dd | Month-Day |
| MM-dd HH | Month-Day Hour |
| MM-dd HH:mm | Month-Day Hour:Minute |
| MM-dd HH:mm:ss | Month-Day Hour:Minute:Second |
| yyyy-MM-dd | Year-Month-Day |
| yyyy-MM-dd HH:mm:ss | Year-Month-Day Hour:Minute:Second |
condition/timeRange example
{
"uri":"condition/timeRange",
"params":{
"format":"HH:mm",
"beginDate":"8:30",
"endDate":"23:00",
"repeat":"1,2,3,4,5"
}
}Rule limits
Scene rules have the following limits:
- A Trigger component is optional. If a scenario has no trigger, it is not automatically triggered. You can call the Execute a scenario API to manually trigger it. For example, if you only set `condition/timeRange` but no trigger, the scenario is not automatically triggered.
- A Condition component is optional. If a scenario has no condition, the Action is executed directly when the Trigger is activated.
- An Action component is required.
- A user can create up to 200 scenarios.
- A rule can have a maximum of 10 Triggers.
- A rule can have a maximum of 5 Conditions.
- A rule can have a maximum of 30 Actions.
- A device can be the target of an Action in a maximum of 20 scenarios.
- A rule can have only one `trigger/timer` component.
- A rule can have only one `condition/timeRange` component.
- In CA rules, only `all` mode supports the `condition/timeRange` component. This component is ignored in `any` mode.
Create a scenario
Description
| path | Version | Description | Logon required |
| /scene/create | 1.0.5 | Creates a scenario. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| groupId | String | Yes | Used to classify scenarios.
|
| enable | Boolean | Yes | Specifies whether to enable the scenario upon creation. `true` indicates enabled, and `false` indicates disabled. |
| name | String | Yes | The name of the scenario. |
| icon | String | Yes | The download link for the scenario icon. |
| iconColor | String | Yes | The color of the scenario icon, such as #FFFFFF. |
| description | String | No | The description of the scenario. |
| triggers | Object | No | The trigger object for an IFTTT rule. |
| conditions | Object | No | The condition object for an IFTTT rule. |
| caConditions | JSON Array | No | The condition object for a CA rule. |
| actions | JSON Array | Yes | The action object. |
| sceneType | String | No | The type of the scene rule. Valid values are `IFTTT` and `CA`. The default value is `IFTTT`. |
| mode | String | No | The mode for a CA rule.
|
Response parameters
| Parameter | Type | Description |
| sceneId | String | The ID of the created scenario. |
Examples
- Request example for creating a CA rule scenario
{ "groupId":"1", "enable":true, "name":"ilopTestScene", "icon":"http://www.aliyundoc.com/***.png", "iconColor":"#FFFFFF", "caConditions":[ { "params":{ "cron":"42 00 * * *", "cronType":"linux", "timezoneId":"Asia/Shanghai" }, "uri":"condition/timer" }, { "params":{ "compareValue":0, "compareType":"==", "propertyName":"PowerSwitch", "productKey":"xxxx", "deviceName":"xxxx" }, "uri":"condition/device/property" } ], "actions":[ { "params":{ "iotId":"xxxx", "propertyName":"PowerSwitch", "propertyValue":1 }, "uri":"action/device/setProperty" } ], "sceneType":"CA", "mode":"all" } - Request example for creating an IFTTT rule scenario (single Trigger, single Condition)
{ "sceneType":"IFTTT", "enable":true, "groupId":"1", "name":"TestScene", "icon":"http://www.aliyundoc.com/***.png", "iconColor":"#FFFFFF", "triggers":{ "params":{ "cron":"42 00 * * *", "cronType":"linux", "timezoneId":"Asia/Shanghai" }, "uri":"trigger/timer" }, "conditions":{ "uri":"logical/and", "items":[ { "params":{ "cron":"20-25 11-23 * * 1,2,3", "cronType":"linux", "timezoneID":"Asia/Shanghai" }, "uri":"condition/timeRange" } ] }, "actions":[ { "params":{ "iotId":"xxxx", "propertyName":"PowerSwitch", "propertyValue":1 }, "uri":"action/device/setProperty" } ] } - Request example for creating an IFTTT rule scenario (multiple Triggers, multiple Conditions)
{ "sceneType":"IFTTT", "enable":true, "groupId":"1", "name":"testScene", "icon":"http://www.aliyundoc.com/***.png", "iconColor":"#FFFFFF", "triggers":{ "uri":"logical/or", "items":[ { "params":{ "cron":"42 00 * * *", "cronType":"linux", "timezoneId":"Asia/Shanghai" }, "uri":"trigger/timer" }, { "params":{ "iotId":"testIotId", "propertyName":"PowerSwitch", "compareType":"==", "compareValue":0 }, "uri":"trigger/device/property" } ] }, "conditions":{ "uri":"logical/and", "items":[ { "params":{ "cron":"20-25 11-23 * * 1,2,3", "cronType":"linux", "timezoneID":"Asia/Shanghai" }, "uri":"condition/timeRange" }, { "params":{ "iotId":"testIotId", "propertyName":"PowerSwitch", "compareType":"==", "compareValue":0 }, "uri":"condition/device/property" } ] }, "actions":[ { "params":{ "iotId":"testIotId", "propertyName":"PowerSwitch", "propertyValue":1 }, "uri":"action/device/setProperty" } ] } - Successful response example
{ "code": 200, "data": "sceneId", "message": "success" }
Update a scenario
Description
| Path | Version | Description | Logon required |
| /scene/update | 1.0.5 | Updates a scenario. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| groupId | String | Yes | Used to classify scenarios.
Note You specify `groupId` when you create a scenario. After the scenario is created, you cannot change the `groupId`. This means you cannot change a manual scenario to an automated scenario by modifying the `groupId`. |
| sceneId | String | Yes | The scenario ID. |
| enable | Boolean | Yes | `true` indicates that the scenario is enabled. `false` indicates that the scenario is disabled. |
| name | String | Yes | The name of the scenario. |
| icon | String | Yes | Scenario icon URL |
| iconColor | String | Yes | The color of the scenario icon. |
| description | String | No | The description of the scenario. |
| triggers | Object | No | The trigger object for an IFTTT rule. |
| conditions | Object | No | The condition object for an IFTTT rule. |
| caConditions | Array | No | The condition object for a CA rule. |
| actions | Array | Yes | Action object |
| sceneType | String | No | The type of the scene rule. Valid values are `IFTTT` and `CA`. The default value is `IFTTT`. |
| mode | String | No | The mode for a CA rule. Valid values are `all` and `any`. |
Response parameters
| Parameter | Type | Description |
| sceneId | String | The ID of the updated scenario. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "enable" : true, "iconColor" : "#DE4545", "reBind" : true, "mode" : "any", "caConditions" : [ { "uri" : "condition/timer", "params" : { "cron" : "33 10 * * 1,2,3,4", "cronType" : "linux" } } ], "sceneType" : "CA", "icon" : "http:\\www.aliyundoc.com/***.png", "sceneId" : "2420d2xxxxf93c54fc4e", "groupId" : "1", "name" : "10:27 Mon Tue - Power Switch On", "actions" : [ { "uri" : "action/device/setProperty", "params" : { "iotId" : "uumR5xxxx00101", "propertyName" : "PowerSwitch", "propertyValue" : 1 } } ] } } - Successful response example
{ "code": 200, "data": "bdc60bexxxxd617697", "message": "success" }
Delete a scenario
Description
| Path | Version | Description | Logon required |
| /scene/delete | 1.0.2 | Delete Scenario | Yes |
Request parameters
| Parameter | Type | Required | Description |
| sceneId | String | Yes | The scenario ID. |
Response parameters
| Parameter | Type | Description |
| sceneId | String | The ID of the deleted scenario. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "sceneId": "0c965xxxx5306a6657", "groupId": null } } - Successful response example
{ "code": 200, "data": "0c9653xxxx06a6657", "message": "success" }
Query a list of scenarios or automations
Description
| Path | Version | Description | Logon required |
| /scene/list/get | 1.0.5 | Query scenarios | Yes |
Request parameters
| Parameter | Type | Required | Description |
| groupId | String | Yes | `0`: scenario. `1`: automation. |
| pageNo | Integer | Yes | The page number. It must be greater than or equal to 1. |
| pageSize | Integer | Yes | The number of entries per page. The value must be between 1 and 50. |
Response parameters
| Parameter | Sub-parameter | Type | Description |
| total | Integer | The total number of entries. | |
| pageNo | Integer | The page number, starting from 1. | |
| pageSize | Integer | The number of entries per page. | |
| scenes | Array | Returns the entries on the current page. | |
| scenes.id | String | The scenario ID. | |
| scene.status | Integer | The runtime status of the scenario. `1`: online. `2`: offline. | |
| scene.enable | Boolean | The switch for the scenario (the switch in the app). `true`: The scenario is turned on. `false`: The scenario is turned off. | |
| scene.icon | String | The link to the scenario icon. | |
| scene.iconColor | String | The color of the scenario icon. | |
| scene.name | String | The name of the scenario. | |
| scene.description | String | The description of the scenario. | |
| scene.valid | Boolean | Indicates whether the scenario is valid. | |
| scene.groupId | String | The type. `null`: an old version scenario. `0`: a scenario. `1`: an automation. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "groupId": "1", "pageSize": 20, "pageNo": 1, } } - Successful response example
{ "code": 200, "data": { "pageNo": 1, "pageSize": 20, "scenes": [{ "description": "Electric blanket-hy-Signal-to-noise ratio--127 ", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "260de82dxxxx691be22", "name": "Electric blanket", "status": 2, "iconColor":"#19BBFF", "valid":false, "groupId":"1" }, { "description": "light-hy-LightSwitch-1, shuijin-hy-WiFI_SNR--127 ", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "45dc6fcxxxx6974e5f7", "name": "Liang Gong", "status": 1, "iconColor":"#19BBFF", "valid":true, "groupId":"1" }, { "description": "fengsan-hy-PowerSwitch-Off, light-hy-LightSwitch-1 ", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "3ce636xxxx1367f2dc88", "name": "Fan light 0522", "status": 1, "iconColor":"#19BBFF", "valid":false, "groupId":"1" }, { "description": "light-hy-LightSwitch-1 ", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "5b4bdexxxx2612f81", "name": "Light 0522", "status": 2, "iconColor":"#19BBFF", "valid":false, "groupId":"1" }], "total": 4 }, "message": "success" }
Query lists of scenarios and automations at the same time
Description
| Path | Version | Description | Logon required |
| /scene/list/all | 1.0.0 | Queries all scenario information on the My Smart page, including scenarios and automations. | Yes. The client software development kit (SDK) must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| pageNo | Integer | No | The current page number. The default value is 1. |
| pageSize | Integer | Yes | The number of entries per page. The value must be greater than or equal to 1 and less than or equal to 30. |
Response parameters
| Parameter | Level 2 sub-parameter | Level 3 sub-parameter | Level 4 sub-parameter | Type | Description |
| data | String | A list of scenarios and automations. | |||
| scene0 | String | Information about the list of scenarios. | |||
| total | Integer | The total number of scenarios. | |||
| pageNo | Integer | Returns the current page number. | |||
| pageSize | Integer | The number of entries returned on the page. | |||
| scenes | String | Scenarios | |||
| id | String | The scenario ID. | |||
| name | String | The name of the scenario. | |||
| description | String | The description of the scenario. | |||
| enable | Boolean | The switch for the scenario (the switch in the app). `true`: The scenario is turned on. `false`: The scenario is turned off. | |||
| icon | String | Scenario Icon Link | |||
| iconColor | String | The color of the scenario icon. | |||
| groupId | String | The classification. `0`: scenario. `1`: automation. | |||
| valid | Boolean | Indicates whether the scenario is valid. When a device in the scenario is detached, the automation becomes invalid. | |||
| scene1 | String | Information about the list of automations. | |||
| total | Integer | The total number of automations. | |||
| pageNo | Integer | The current page number. | |||
| pageSize | Integer | The number of entries per page. | |||
| scenes | String | A list of automations. | |||
| id | String | Automation ID | |||
| name | String | The name of the automation. | |||
| description | String | The description of the automation. | |||
| enable | Boolean | The switch for the automation (the switch in the app). `true`: The scenario is turned on. `false`: The scenario is turned off. | |||
| icon | String | The automation icon. | |||
| iconColor | String | Automation Icon Color | |||
| groupId | String | The classification. `0`: scenario. `1`: automation. | |||
| valid | Boolean | Indicates whether the automation is valid. When a device in the automation is detached, the automation becomes invalid. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": { "pageNum": 1, "pageSize": 10 } } - Successful response example
{ "code": 200, "data": { "scene0": { "total": 1, "scenes": [ { "id": "", "name": "", "description": "", "enable": true, "icon": "", "iconColor": "", "groupId": "0", "valid": true } ], "pageNo": 1, "pageSize": 10 }, "scene1": { "total": 0, "scenes": [], "pageNo": 1, "pageSize": 10 } }, "message": "success" }
Change the sort order of items in a scenario list
Description
| Path | Version | Description | Logon required |
| /scene/list/reorder | 1.0.5 | Changes the sort order of items in a scenario list. | Yes |
Request parameters
| Parameter | Sub-parameter | Type | Required | Description |
| groupId | String | Yes | `0`: scenario. `1`: automation. | |
| newOrders | Array | Yes | An array of scenarios whose sort order has changed. | |
| sceneId | String | Yes | The scenario ID. | |
| fromOrder | Integer | Yes | The original ordinal number before the order change. | |
| toOrder | Integer | Yes | The new ordinal number. |
Response parameters
| Parameter | Type | Description |
| code | Integer | Operation successful |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "groupId": null, "newOrders": [{ "fromOrder": 1, "sceneId": "a596dexxxx9685d25", "toOrder": 2 }, { "fromOrder": 2, "sceneId": "c1a8de4xxxxb473c3", "toOrder": 1 }] } } - Successful response example
{ "code": 200, "message": "success" }
Execute a scenario
Description
| Path | Version | Description | Logon required |
| /scene/fire | 1.0.2 | Executes a scenario. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| sceneId | String | Yes | The ID of the scenario to trigger. |
Response parameters
| Parameter | Type | Description |
| sceneId | String | The ID of the triggered scenario. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "groupId": null, "sceneId": "debf2dxxxx51496c2" } } - Successful response example
{ "code": 200, "data": "debf2dxxxx51496c2", "message": "success" }
Get a list of scenario logs
Description
| Path | Version | Description | Logon required |
| /scene/log/list/get | 1.0.2 | Gets a list of scenario logs. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| pageNo | Integer | Yes | The page number. It must be greater than or equal to 1. |
| pageSize | Integer | Yes | The number of entries to retrieve at a time. |
| nowTime | Long | Yes | The start time of the log query, in milliseconds. The format is the same as that of a scenario log query. |
The `nowTime` parameter sets the end of the time range for the log query. The API returns logs from the 15-day period before this time. To start a new query from a different time, provide a new `nowTime` value and reset `pageNo` to 1.
Response parameters
| Parameter | Type | Description |
| pageNo | Integer | The page number. It must be greater than or equal to 1. |
| pageSize | Integer | The number of entries retrieved at a time. |
| total | Integer | The total number of entries. |
| logs | Array | A list of logs, returned in descending order of time. |
| logs.time | Long | The log time, as a timestamp in milliseconds. |
| logs.icon | String | The scenario icon. |
| logs.sceneId | String | The scenario ID. |
| logs.id | String | The log ID. |
| logs.sceneName | String | The name of the scenario. |
| logs.result | Integer | The execution result. `0`: failed. `1`: successful. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "pageNo": 1, "pageSize": 5, "groupId": null, "nowTime": 1527129084824 } } - Successful response example
{ "code": 200, "data": { "logs": [{ "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "0bc19f5d15xxxx56576d52bf", "result": 0, "sceneId": "d5edf3a8xxxx91b15e2028", "sceneName": "t time device", "time": 1527091200000 }, { "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "0bc19f5xxxx056577d52bf", "result": 0, "sceneId": "81eb22a2991xxxx2d0993ce", "sceneName": "t time", "time": 1527091200000 }, { "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "0bc19f5d15xxxx75d52bf", "result": 0, "sceneId": "3f522ebxxxx12336709", "sceneName": "test", "time": 1527091200000 }, { "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "0bc19fxxxx578d52bf", "result": 0, "sceneId": "32020xxxx757ee3", "sceneName": "t time device", "time": 1527091200000 }, { "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "0bc19f5xxxx14d52bf", "result": 1, "sceneId": "70d90fexxxx997188911", "sceneName": "light", "time": 1527054987000 }], "pageNo": 1, "pageSize": 5, "total": 62 }, "message": "success" }
Get the details of a failed log
Description
| Path | Version | Description | Logon required |
| /scene/failedlog/get | 1.0.4 | Gets the details of a failed log. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| logId | String | Yes | The ID of the log to query. |
| sceneId | String | Yes | The scenario ID. |
| time | Long | Yes | The `logs.time` returned by `/scene/log/list/get`, in milliseconds. |
| pageNo | Integer | Yes | The page number. The first page is 1. |
| pageSize | Integer | Yes | The number of entries to retrieve at a time. |
Response parameters
| Parameter | Type | Description |
| total | Integer | Total |
| pageSize | Integer | The number of entries retrieved at a time. |
| pageNo | Integer | The page number. It must be greater than or equal to 1. |
| details | Array | None |
| details.productKey | String | A list of details for the failed device. |
| details.localizedProductName | String | Localized product information. |
| details.deviceName | String | The deviceName of the device. |
| details.aliasName | String | The name given to the device by the user. |
| details.failedReason | String | The error message. If the action was to set a property, the format is: {Product Name}-{Property Name}-{Property Value} execution failed. If the action was to call a service, the format is: {Product Name}-{Service Name} execution failed. |
| details.detail | String | Subscript Annotation Reason |
| details.icon | String | The icon. |
Examples
- Request example
{ "id": "150xxxx4180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "pageNo": 1, "pageSize": 1000, "logId": "0bc19xxxx00056576d52bf", "sceneId": "d5edf3xxxx91b15e2028", "time": 1527091200000 } } - Successful response example
{ "code": 200, "data": { "details": [{ "detail": "light-hy - NightLightSwitch - Off 1 Set device parameters", "deviceName": "hyxxxxhy", "failedReason": "device in scene's action is unbind", "productKey": "b1xxxxrm" }], "pageNo": 1, "pageSize": 1000 }, "message": "success" }
Get scenario details
Description
| Path | Version | Description | Logon required |
| /scene/info/get | 1.0.5 | Gets the details of a scenario. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| sceneId | String | Yes | The ID of the scenario to query. |
| groupId | String | No | The scenario type:
|
Response parameters
| Parameter | Type | Description |
| sceneId | String | Scenario ID |
| enable | Boolean | The status of the scenario switch. Valid values:
|
| name | String | The name of the scenario. |
| icon | String | The scenario icon. |
| iconColor | String | The color of the scenario icon. |
| description | String | The description of the scenario. |
| triggersJson | Object | JSON serialization of the complex object in the Trigger of an IFTTT rule, used for frontend display. |
| conditions | Object | The condition object for an IFTTT rule. |
| caConditionsJson | Array | Since Scene Service 2.0, this is the JSON serialization of the complex object in the Condition of a CA rule, used for frontend display. |
| actionsJson | String | JSON serialization of the complex object in the Action, used for frontend display. |
| sceneType | String | Since Scene Service 2.0, this is the scene rule type. Valid values are `IFTTT` and `CA`. The default value is `IFTTT`. |
| mode | String | Since Scene Service 2.0, this is the mode for a CA rule. Valid values are `all` and `any`. |
| valid | Boolean | Indicates whether the scenario is valid. |
Enable and disable a scenario
Description
| Path | Version | Description | Logon required |
| /living/scene/switch | 1.0.0 | Enables or disables a scenario automation. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| sceneId | String | Yes | The scenario ID. |
| enable | Boolean | Yes | The status of the scenario switch. Valid values:
|
Response parameters
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": { "sceneId": "0c96536xxxxc5306a6657", "enable": true } } - Successful response example
{ "code": 200, "message": "success" }
Get a list of devices under the current user that support trigger, condition, or action configurations
Description
| Path | Version | Description | Logon required | Notes |
| /scene/thing/list | 1.0.2 | Queries for a list of devices that support Trigger/Condition/Action (T/C/A). | Yes. The client SDK must enable identity authentication. | Includes shared devices. |
Request parameters
| Parameter | Type | Required | Description |
| flowType | Integer | Yes | The flow type. `0`: trigger. `1`: condition. `2`: action. |
| pageNum | Integer | Yes | The page number, starting from 1. |
| pageSize | Integer | Yes | The number of entries per page. |
Response parameters
| Parameter | Type | Description |
| pageNo | Integer | The page number, starting from 1. |
| pageSize | Integer | The maximum number of items per page. |
| total | Long | The total number of records. |
| data | List | Device List |
| Parameter | Type | Description |
| iotId | String | The device ID. |
| deviceName | String | Device name |
| productKey | String | Product key |
| nickName | String | The nickname of the device. |
| image | String | The URL of the category icon. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "flowType": 0, "pageNum": 1, "pageSize": 20 } } - Successful response example
{ "code": 200, "data": { "pageNo": 1, "pageSize": 20, "total":1, "data": [{ "iotId": "45dc6xxxxf6974e5f7", "deviceName": "xxxx", "productKey": "xxxx", "nickName": "Test device", "image": "https://g.aliplus.com/scene_icons/default.png" }] }, "message": "success" }
Get a list of feature properties that support trigger, condition, or action configurations on a device
Description
| Path | Version | Description | Logon required |
| /iotid/scene/ability/list | 1.0.2 | Queries for a list of features that support Trigger/Condition/Action (T/C/A) on a device. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotId | String | Yes | The device ID. |
| flowType | Integer | Yes | The flow type. `0`: trigger. `1`: condition. `2`: action. |
Response parameters
| Parameter | Type | Description |
| name | String | The feature name. |
| identifier | String | The feature identifier. |
| categoryType | String | The category name. |
| type | Integer | The feature type. `1`: property. `2`: service. `3`: event. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "iotId": "45dc6fxxxx29f6974e5f7", "flowType": 0 } } - Successful response example
{ "code": 200, "data": [{ "name": "Switch", "identifier": "switch", "categoryType": "xxxx", "type": 1 }], "message": "success" }
Get the trigger, condition, or action feature list and TSL definition of a device
Description
| Path | Version | Description | Logon required |
| /iotid/scene/ability/tsl/list | 1.0.2 | Queries for a list of features that support Trigger/Condition/Action (T/C/A) and the corresponding Thing Specification Language (TSL) information for a device. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotId | String | Yes | The device ID. |
| flowType | Integer | Yes | The flow type. `0`: trigger. `1`: condition. `2`: action. |
Response parameters
| Parameter | Type | Description |
| simplifyAbilityDTOs | List | A list of feature definitions. |
| abilityDsl | JSONObject | The TSL of the product features (for reference). |
| Parameter | Type | Description |
| name | String | The feature name. |
| identifier | String | The feature identifier. |
| categoryType | String | The category name. |
| type | Integer | The feature type. `1`: property. `2`: service. `3`: event. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "iotId": "45dc6fxxxx6974e5f7", "flowType": 0 } } - Successful response example
{ "code": 200, "data": { "simplifyAbilityDTOs":[{ "name": "Switch", "identifier": "switch", "categoryType": "xxxx", "type": 1 }], "abilityDsl": {} }, "message": "success" }
Create a scheduled scenario for a device
Description
| Path | Version | Description | User identity authentication required |
| /scene/timing/create | 1.0.2 | Creates a scheduled scenario for a device. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotId | String | Yes | The device ID. |
| enable | Boolean | Yes | `true`: on. `false`: off. |
| name | String | Yes | The name that you specify for the scenario. |
| icon | String | Yes | The scenario icon. |
| description | String | No | The description of the scenario. |
| triggers | Object | No | The trigger object. |
| conditions | Object | No | The condition object. |
| actions | Array | Yes | The action object. |
Response parameters
| Parameter | Type | Description |
| sceneId | String | The ID of the new scenario. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.2", "iotToken": "token" }, "params": { "actions": [{ "params": { "compareValue": 1, "iotId": "zjoOvFxxxxc4dc00", "compareType": ">", "propertyName": "Qxxxxat", "propertyValue": 1 }, "uri": "action/device/setProperty" }], "iotId":"zjoOvFZxxxx4dc00", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "name": "Same", "triggers": { "params": {}, "items": [{ "params": { "cron": "1 1 * * *", "cronType": "linux", "timezoneID": "Asia/Shanghai" }, "uri": "trigger/timer" }], "uri": "logical/or" } } } - Successful response example
{ "code": 200, "data": "0c9653xxxx645c5306a6657", "message": "success" }
Update a scheduled scenario for a device
Description
| Path | Version | Description | User identity authentication required |
| /scene/timing/update | 1.0.2 | Updates a scheduled scenario for a device. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotId | String | Yes | The device ID. |
| sceneId | String | Yes | The scenario ID. |
| enable | Boolean | Yes | `true`: on. `false`: off. |
| name | String | Yes | The name of the scenario. |
| icon | String | Yes | The scenario icon. |
| description | String | No | The description of the scenario. |
| triggers | Object | No | The trigger object. |
| conditions | Object | No | Condition object |
| actions | Array | Yes | The action object. |
Response parameters
| Parameter | Type | Description |
| sceneId | String | The scenario ID. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.2", "iotToken": "token" }, "params": { "actions": [{ "params": { "compareValue": 0, "iotId": "gaI0CRxxxx09b3700", "compareType": { "i18nKey": "scene.common.compareType.equal", "type": "==" }, "propertyName": "Nigxxxxwitch", "propertyValue": 0 }, "uri": "action/device/setProperty", "status": 1 }], "conditions": { "params": {}, "items": [{ "params": { "compareValue": 0, "iotId": "gaI0Cxxxx09b3700", "compareType": "==", "propertyName": "LightSwitch", "propertyValue": 0 }, "uri": "condition/device/property", "status": 1 }], "uri": "logical/and" }, "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "name": "", "sceneId": "bdc60xxxx7d617697", "iotId": "gaI0CRKxxxx09b3700", "triggers": { "params": {}, "items": [{ "params": { "cron": "0 0 * * *", "cronType": "linux", "timezoneID": "Asia/Shanghai" }, "uri": "trigger/timer", "status": 1 }], "uri": "logical/or" } } } - Successful response example
{ "code": 200, "data": "0c9653xxxx06a6657", "message": "success" }
Delete a scheduled scenario for a device
Description
| Path | Version | Description | User identity authentication required |
| /scene/timing/delete | 1.0.2 | Deletes a scheduled scenario. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotId | String | Yes | Device ID |
| sceneId | String | Yes | The scenario ID. |
Response parameters
| Parameter | Type | Description |
| sceneId | String | The ID of the deleted scenario. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.2", "iotToken": "token" }, "params": { "sceneId": "0c96xxxx306a6657", "iotId": "gaI0Cxxxx109b3700" } } - Successful response example
{ "code": 200, "data": "0c9653xxxx06a6657", "message": "success" }
Get the details of a scheduled scenario for a device
Description
| Path | Version | Description | User identity authentication required |
| /scene/timing/info/get | 1.0.2 | Gets the details of a scheduled scenario. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotId | String | Yes | The device ID. |
| sceneId | String | Yes | The ID of the scenario to query. |
Response parameters
| Parameter | Type | Description |
| sceneId | String | The scenario ID. |
| enable | Boolean | The scenario switch. `true`: on. `false`: off. |
| status | Integer | The runtime status of the scenario. `1`: running. `2`: invalid. |
| name | String | The name of the scenario. |
| icon | String | The scenario icon. |
| triggers | Object | A string representation of the triggers object. The trigger object is defined below. |
| conditions | Object | A string representation of the conditions object. |
| actions | Array | A string representation of the actions object. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.2", "iotToken": "token" }, "params": { "sceneId": "260de8xxxx4691be22", "iotId": "gaI0Cxxxx9b3700" } } - Successful response example
{ "code": 200, "data": { "actions": [{ "params": { "compareValue": -127, "localizedProductName": "Electric blanket-hy", "iotId": "SY7a6Ixxxx0c00", "compareType": "==", "propertyName": "WiFI_SNR", "localizedPropertyName": "Signal-to-noise ratio", "deviceNickName": "Electric blanket-hy", "propertyValue": -127, "localizedCompareValueName": "-127", "productKey": "b1xxxxql", "propertyItems": { "WiFI_SNR": -127 }, "deviceName": "hyhyhy4" }, "uri": "action/device/setProperty", "status": 0 }], "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "name": "Electric blanket", "sceneId": "260de82dxxxx4691be22", "status": 2 }, "message": "success" }
Query a list of scheduled scenarios for a device
Description
| Path | Version | Description | User identity authentication required |
| /scene/timing/list/get | 1.0.2 | Queries a list of scheduled scenarios. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotId | String | Yes | The device ID. |
| pageNo | Integer | Yes | The page number. It must be greater than or equal to 1. |
| pageSize | Integer | Yes | The number of entries per page. The value must be between 1 and 50. |
Response parameters
| Parameter | Sub-parameter | Type | Description |
| total | Integer | The total number of entries. | |
| pageNo | Integer | The page number, starting from 1. | |
| pageSize | Integer | The number of entries per page. | |
| scenes | Array | The entries on the current page. | |
| scenes.id | String | The scenario ID. | |
| scene.status | Integer | The runtime status of the scenario. `1`: online. `2`: offline. | |
| scene.enable | Boolean | The switch for the scenario (the switch in the app). `true`: The scenario is turned on. `false`: The scenario is turned off. | |
| scene.icon | String | Scenario Icon Link | |
| scene.name | String | The name of the scenario. | |
| scene.description | String | The description of the scenario. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.2", "iotToken": "token" }, "params": { "pageSize": 20, "pageNo": 1, "iotId": "zjoOvFZxxxx0c4dc00" } } - Successful response example
{ "code": 200, "data": { "pageNo": 1, "pageSize": 20, "scenes": [{ "description": "Electric blanket-hy-Signal-to-noise ratio--127 ", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "260de82xxxx691be22", "name": "Electric blanket", "status": 2 }, { "description": "light-hy-LightSwitch-1, shuijin-hy-WiFI_SNR--127 ", "enable": true, "icon": "https://g.aliplus.com/scene_icons/default.png", "id": "45dc6fcxxxx6974e5f7", "name": "Liang Gong", "status": 1 }], "total": 2 }, "message": "success" }
Get the details of multiple scenarios in a batch
Description
| Path | Version | Description | User identity authentication required |
| /living/scene/batchget | 1.0.0 | Requests scenario information in a batch. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| sceneIdList | list | Yes | A list of scenario IDs to query. |
Response parameters
| Parameter | Type | Description |
| sceneId | String | The scenario ID. |
| enable | Boolean | The scenario switch. `true`: on. `false`: off. |
| name | String | Scenario name |
| icon | String | Scenario Icon |
| triggers | String | A string representation of the triggers object. |
| conditions | String | A string representation of the conditions object. |
| actions | String | A string representation of the actions object. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": {"sceneIdList":["b8fe2xxxx26b76c31"]} } - Successful response example
{ "code":200, "data": [ {"sceneType":"IFTTT", "name":"Main light switch On - Light mode mono - On", "icon":"https://img.alicdn.com/tfs/TB10G8xxxxUVXa-144-144.png", "sceneId":"b8fexxxx26b76c31", "sceneSwitch":1, "triggers":"{\"params\":{},\"items\":[{\"params\":{\"eventCode\":\"\",\"compareValue\":1,\"iotId\":\"z8nxxxx00101\",\"compareType\":\"==\",\"propertyName\":\"LightSwitch\",\"propertyValue\":1,\"productKey\":\"a1B0kMs35NW\",\"deviceName\":\"z8nxxxx6SFY\"},\"uri\":\"trigger/device/property\"}],\"uri\":\"logical/or\"}", "conditions":"{\"params\":{},\"items\":[{\"params\":{\"eventCode\":\"\",\"compareValue\":0,\"iotId\":\"z8nqxxxx000101\",\"compareType\":\"==\",\"propertyName\":\"LightMode\",\"propertyValue\":0,\"productKey\":\"a1B0kMs35NW\",\"deviceName\":\"z8nxxxx6SFY\"},\"uri\":\"condition/device/property\"}],\"uri\":\"logical/and\"}", "actions":"[{\"params\":{\"switchStatus\":1,\"automationRuleId\":\"50xxxx520ceed\"},\"uri\":\"action/automation/setSwitch\"}]"} ], "id":"1509086454180" }
Push message to mobile phone action
Description
| Path | Description | User identity authentication required |
| /action/mq/send | An action to push a message to a mobile phone. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| customData | CustomData | Yes | The push message model. |
| customData. message | String | Yes | The content of the message to push to the mobile phone. It can be up to 60 characters long. |
| msgTag | String | Yes | The push message model. The default value is `IlopBusiness_CustomMsg`. |
Return Parameters
Examples
- Request example
"actions": [ { "uri":"action/mq/send", "params":{ "customData":{ "message":"The power is on" }, "msgTag":"IlopBusiness_CustomMsg" } } ] - Successful response example
None
Query scenarios for a smart widget
Description
| Path | Version | Description | Logon required |
| /living/appwidget/list | 1.0.0 | Queries for smart widget information. This is used to query component information in the app's quick scenario trigger widget. | Yes |
Request parameters
Response parameters
| Parameter | Type | Description |
| id | String | The scenario ID. |
| name | String | The name of the scenario. |
| description | String | The description of the scenario. |
| enable | Boolean | Indicates whether the scenario is enabled. |
| icon | String | The scenario icon. |
| iconColor | String | The color of the scenario icon. |
| valid | Boolean | Indicates whether the scenario is valid. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": { } } - Successful response example
{ "code": 200, "message": "success" "data":[{ "id": "d5edf3xxxxb15e2028", "iconColor": "#19BBFF", "name": "Send notification to phone", "description": " Description ", "enable": true }, { "id": "debf2dxxxx1496c2", "iconColor": "#FFBBFF", "name": "Turn on light", "description": "Description", "enable": false } ] }
Add a scenario to a smart widget
Description
| Path | Version | Description | Logon required |
| /living/appwidget/create | 1.0.0 | Adds a smart widget. This is used to add a component to the app's quick scenario trigger widget. | Yes |
Request parameters
Response parameters
| Parameter | Type | Description |
| sceneIds | Array | A list of scenario IDs. You can add up to 8 scenarios. |
Examples
- Request example
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": { "sceneIds":["d5edfxxxx5e2028","debfxxxx496c2"] } } - Successful response example
{ "code": 200, "message": "success" }