This service provides APIs for clients to create and configure automated scenes. These scenes execute tasks when specific conditions are met. For example, a device can automatically turn on at a set time.
Scene rule descriptions
Create, edit, delete, and query scenes
- Create scenes or automations
- Update scenes or automations
- Delete scenes or automations
- Retrieve scene or automation details
- Retrieve scene or automation details in batches
- Query a list of scenes or automations
- Query lists of scenes and automations simultaneously
- Change the sort order of a scene list
- Retrieve a list of functional properties that support trigger, condition, or action configurations on a device
- Retrieve a list of devices that support trigger, condition, or action configurations for the current user
- Retrieve the trigger, condition, or action feature list and TSL definition of a device
- Push a message to a mobile phone
- Create a scheduled timed scene
- Update a scheduled timed scene
- Delete a scheduled timed scene
- Retrieve scheduled timed scene details
- Query a list of scheduled timed scenes
Home spaces and scenes
Scene rule descriptions
Scene rules describe the trigger that initiates a task (Trigger), the conditions that must be met (Condition), and the 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 merges the Trigger and Condition nodes into a single "condition" node.
IFTTT rules
The following example shows a typical scene rule. The scene is triggered (Trigger) when the value of the someone_exist property of the device sensor_01 equals 1. The system then checks if the current time is between 6:00 and 22:00 (Condition). If it is, the switch property of the device light 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":"00 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 example above shows an IFTTT scene rule. The rule contains four nodes:
| Name | Description |
| type | The type of the scene rule. Valid values are IFTTT and CA. |
| trigger | The trigger for the scene, such as a specific time or a device property. A scene can have multiple triggers, which are evaluated with an OR logical relationship. A scene can also have no triggers. In this case, you can manually trigger the scene by calling an API. |
| condition | The filter condition after the scene is triggered, such as a time range or a device property limit. A scene can have multiple filter conditions, which are evaluated with an AND logical relationship. A scene can also have no filter conditions. In this case, the action is executed directly after the scene is triggered. |
| action | The action to execute when the scene is triggered and the filter conditions are met. Examples include setting a device property or executing another scene. A scene can have multiple actions. A scene 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 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"
}
}
]
}This rule means the scene is triggered at 10:00 every day or when the someone_exist property of the device sensor_01 equals 1. If the some_property property of the device test_device is less than 10 and the current time is between 9:00 and 12:00, the action is executed. The onOff property of test_device is set to on, and another scene 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 contains 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 or all. any means the action is executed if any condition is met. all means the action is executed only when all conditions are met. |
| condition | The trigger conditions for the scene, such as a specific time, a device property, or a time range. A scene can have multiple trigger conditions. |
| action | The action to execute when the scene is triggered. Examples include setting a device property or executing another scene. A scene can have multiple actions. A scene 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/setStatus",
"params":{
"productKey":"pk_action",
"deviceName":"test_device",
"propertyName":"LightStatus",
"propertyValue": 1
}
}
]
}This rule means that when the some_property 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 component
The supported Trigger components include the following:
| URL | Description | |
| trigger/timer | Timed trigger | |
| trigger/device/property | Device property trigger | |
| trigger/device/event | Device event trigger |
trigger/timer parameters
| 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 format. The year cannot be set. quartz_cron: A 7-field Quartz cron format that supports the year. The minimum precision is minutes. The first field (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 not set, it defaults to the time zone of the IoT Platform service. 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 You cannot use a time in the past. |
| 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 parameters
| Parameter | Type | Description |
| productKey | String | ProductKey of the device. |
| deviceName | String | Name of the device. |
| 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 parameters
| Parameter | Type | Description | |
| productKey | String | Product Key | |
| deviceName | String | Name of the device. | |
| eventCode | String | The event code of the device. This parameter is optional. | |
| propertyName | String | 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 component
The supported Condition components include the following:
| URL | Description Logic |
| condition/timeRange | Compares whether the current time is within a specified range. |
| condition/device/property | Device property filter. |
condition/timeRange parameters
| Parameter | Type | Description |
| cron | String | For example, 20-25 11-23 * * 1,2,3 means the action can be executed between 11:20 and 23:25 on Mondays, Tuesdays, and Wednesdays. |
| cronType | String | The cron expression type. The value is linux. |
| timezoneID | String | Example: Asia/Shanghai |
condition/timeRange example
{
"params":{
"cron":"00 9-12 * * 1,2,3",
"cronType":"linux",
"timezoneID":"Asia/Shanghai"
},
"uri":"condition/timeRange"
}condition/device/property parameters
| Parameter | Type | Description |
| productKey | String | ProductKey |
| deviceName | String | Name of the device. |
| propertyName | String | Device property. |
| compareType | String | The comparison type, such as >, <, >=, ==, <=, !=, in, or like. |
| compareValue | Object | The value to compare. |
condition/device/property example
{
"uri":"condition/device/property",
"params":{
"productKey":"test_product",
"deviceName":"test_device",
"propertyName":"temp",
"compareType":">",
"compareValue":30
}
}Action component
The supported Action components include the following:
| URL | Description |
| action/device/setProperty | Set a device property. |
| action/device/invokeService | Invoke a device service. |
| action/scene/trigger | Trigger another scene. If the triggered scene contains a condition that is not met, the action of the triggered scene is not executed. |
| action/automation/setSwitch | Enable or disable another scene setting. |
action/scene/trigger parameters
| Parameter | Type | Description | Example | |
| sceneId | String | Scene ID. | None |
action/scene/trigger example
{
"uri":"action/scene/trigger",
"params":{
"sceneId":"xxx"
}
}action/device/invokeService parameters
| Parameter | Type | Description | Example | |
| iotId | String | Device ID. | None | |
| serviceName | String | Service name. | None | |
| serviceArgs | JSON | 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 parameters
| Parameter | Type | Description | Example |
| iotId | String | Device ID. | None |
| propertyName | String | The name of the property to set. | PowerSwitch |
| propertyValue | Object | The value of the property to set. | 1 |
action/device/setProperty example
{
"uri":"action/device/setProperty",
"params":{
"iotId":"xxxx",
"propertyName":"PowerSwitch",
"propertyValue":1
}
}action/automation/setSwitch parameters
| Parameter | Type | Description | Example |
| automationRuleId | String | The ID of the scene 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 component
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 the IFTTT type. |
| condition/timeRange | Time range. The function is the same as condition/timeRange in the IFTTT type. It can only be used in all mode and is ignored in any mode. Note The parameter format for the condition/timeRange node in the CA type is different from the one in the IFTTT type. |
| condition/device/property | Device property. The function and parameters are the same as trigger/device/property in the IFTTT type. |
condition/timeRange parameters
| 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 not set, it defaults to the time zone of the IoT Platform service. We recommend that you set this parameter to specify a time zone. |
| beginDate | String | The start time. It must match the specified format. For example, if format is HH:mm, you can set beginDate to 12:30. |
| endDate | String | The end time. It must match the specified 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 is considered to cross over to the next day. For example, if beginDate is 22:00 and endDate is 6:00, the range is from 22:00 on one day to 6:00 on the next day. |
| repeat | String | The days of the week for repetition. It is a string of numbers from 1 to 7, separated by commas. This parameter is optional. If not specified, the action does not repeat. For example, 1,2,3 means repeat on Monday, Tuesday, and Wednesday. |
condition/timeRange format values
| 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
The following limits apply to scene rules:
- A Trigger component is optional. If a trigger is not included, the scene is not automatically triggered and must be executed manually by calling the Execute a scene API. For example, a scene that contains only a condition/timeRange component without a trigger must be executed manually.
- A Condition component is optional. If a condition is not included, the Action is executed immediately when the Trigger is activated.
- An Action component is required.
- A user can create a maximum of 200 scenes.
- 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 10 Actions.
- A device can be the target of an action in a maximum of 20 scenes.
- A rule can have only one trigger/timer component.
- A rule can have only one condition/timeRange component.
- For CA rules, the condition/timeRange component is supported only when the mode is 'all'. The component is ignored when the mode is 'any'.
Create a scene
Description
| Path | Version | Description | Logon required |
| /scene/create | 1.0.5 | Create a scene. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| groupId | String | Yes | Used to classify scenes. For a manual scene, which contains only an Action, set groupId to 0. For an automation scene, which contains a Trigger and a Condition in addition to an Action, set groupId to 1. |
| enable | Boolean | Yes | Specifies whether to enable the scene upon creation. true indicates enable, and false indicates disable. |
| name | String | Yes | The name of the scene given by the user. |
| icon | String | Yes | The download link for the scene icon. |
| iconColor | String | Yes | The color of the scene icon, for example, #FFFFFF. |
| description | String | No | A description of the scene. |
| triggers | Object | No | The trigger object of the IFTTT rule. |
| conditions | Object | No | The condition object of the IFTTT rule. |
| caConditions | JSON Array | No | The condition object of the CA rule. |
| actions | JSON Array | Yes | The action object. |
| sceneType | String | No | The scene rule type. Valid values are IFTTT and CA. The default value is IFTTT. |
| mode | String | No | The mode of the CA rule. Valid values are all and any. all means the action is executed only when all conditions in caConditions are met. any means the action is executed if any condition in caConditions is met. |
Response parameters
| Parameter | Type | Description |
| sceneId | String | The ID of the created scene. |
Examples
- Example request to create a scene with a CA rule
{ "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" } - Example request to create a scene with an IFTTT rule (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" } ] } - Example request to create a scene with an IFTTT rule (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" } ] } - Example of a successful response
{ "code": 200, "data": "sceneId", "message": "success" }
Update a scene
Description
| Path | Version | Description | Logon required |
| /scene/update | 1.0.5 | Update a scene. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| groupId | String | Yes | Used to classify scenes. For a manual scene, which contains only an Action, set groupId to 0. For an automation scene, which contains a Trigger and a Condition in addition to an Action, set groupId to 1. Note The groupId is specified when the scene is created and cannot be modified afterward. You cannot change a manual scene to an automation scene by modifying the groupId. |
| sceneId | String | Yes | Scene ID. |
| enable | Boolean | Yes | true indicates enable the scene. false indicates disable the scene. |
| name | String | Yes | The name of the scene. |
| icon | String | Yes | The URL of the scene icon. |
| iconColor | String | Yes | The color of the scene icon. |
| description | String | No | A description of the scene. |
| triggers | Object | No | The trigger object of the IFTTT rule. |
| conditions | Object | No | The condition object of the IFTTT rule. |
| caConditions | Array | No | The condition object of the CA rule. |
| actions | Array | Yes | The action object. |
| sceneType | String | No | The scene rule type. Valid values are IFTTT and CA. The default value is IFTTT. |
| mode | String | No | The mode of the CA rule. Valid values are all and any. |
Response parameters
| Parameter | Type | Description |
| sceneId | String | Updated Scenario ID |
Examples
- Example request
{ "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 } } ] } } - Example of a successful response
{ "code": 200, "data": "bdc60bexxxxd617697", "message": "success" }
Delete a scene
Description
| Path | Version | Description | Logon required |
| /scene/delete | 1.0.2 | Delete a scene. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| sceneId | String | Yes | Scene ID. |
Response parameters
| Parameter | Type | Description |
| sceneId | String | The ID of the deleted scene. |
Examples
- Example request
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "sceneId": "0c965xxxx5306a6657", "groupId": null } } - Example of a successful response
{ "code": 200, "data": "0c9653xxxx06a6657", "message": "success" }
Query a list of scenes or automations
Description
| Path | Version | Description | Logon required |
| /scene/list/get | 1.0.5 | Query a list of scenes. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| groupId | String | Yes | 0 = Scene, 1 = Automation. |
| pageNo | Integer | Yes | The page number. Must be greater than or equal to 1. |
| pageSize | Integer | Yes | The number of items per page. Must be between 1 and 50. |
Response parameters
| Parameter | Sub-parameter | Type | Description |
| total | Integer | Total number of items. | |
| pageNo | Integer | The page number, starting from 1. | |
| pageSize | Integer | The number of items per page. | |
| scenes | Array | Returns the entries for the current page. | |
| scenes.id | String | Scene ID. | |
| scene.status | Integer | The runtime status of the scene: 1 - Scene is online. 2 - Scene is offline. | |
| scene.enable | Boolean | The scene switch (the switch in the app): true - Scene is on. false - Scene is off. | |
| scene.icon | String | The link to the scene icon. | |
| scene.iconColor | String | The color of the scene icon. | |
| scene.name | String | Scene name. | |
| scene.description | String | Scene description. | |
| scene.valid | Boolean | Indicates whether the scene is valid. | |
| scene.groupId | String | Type: null (Legacy scenario), 0 (Scenario), or 1 (Automation). |
Examples
- Example request
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "groupId": "1", "pageSize": 20, "pageNo": 1, } } - Example of a successful response
{ "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": "fan-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 scenes and automations at the same time
Description
| Path | Version | Description | Logon required |
| /scene/list/all | 1.0.0 | Queries all scene information on the My Smart page, including scenes and automations. | Yes. The client 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 page size. 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 | List of scenes and automations. | |||
| scene0 | String | Scene list information. | |||
| total | Integer | Total number of scenes. | |||
| pageNo | Integer | Returns the current page number. | |||
| pageSize | Integer | The returned page size. | |||
| scenes | String | Scene list. | |||
| id | String | Scene ID. | |||
| name | String | Scene name. | |||
| description | String | Scene description. | |||
| enable | Boolean | The scene switch (the switch in the app): true - Scene is on. false - Scene is off. | |||
| icon | String | The link to the scene icon. | |||
| iconColor | String | The color of the scene icon. | |||
| groupId | String | Classification. 0 indicates a scene. 1 indicates an automation. | |||
| valid | Boolean | Indicates whether the scene is valid. When a device in a scene is detached, the automation becomes invalid, and this field is set to true. | |||
| scene1 | String | Automation list information. | |||
| total | Integer | Total number of automations. | |||
| pageNo | Integer | The returned page number. | |||
| pageSize | Integer | The returned page size. | |||
| scenes | String | Automation list. | |||
| id | String | Automation ID. | |||
| name | String | Automation name. | |||
| description | String | Automation description. | |||
| enable | Boolean | The automation switch (the switch in the app): true - Scene is on. false - Scene is off. | |||
| icon | String | Automation icon. | |||
| iconColor | String | Automation icon color | |||
| groupId | String | Classification. 0 indicates a scene. 1 indicates an automation. | |||
| valid | Boolean | Indicates whether the automation is valid. When a device in an automation is detached, the automation becomes invalid, and this field is set to true. |
Examples
- Example request
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": { "pageNum": 1, "pageSize": 10 } } - Example of a successful response
{ "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 scene list
Description
| Path | Version | Description | Logon required |
| /scene/list/reorder | 1.0.5 | Change the sort order of items in a scene list. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| groupId | String | Yes | 0 - Scene. 1 - Automation. |
| newOrders | Array | Yes | An array of scenes with changed ordinal numbers. |
| newOrders.sceneId | String | Yes | Scene ID. |
| newOrders.fromOrder | Integer | Yes | The ordinal number before the order change. |
| newOrders.toOrder | Integer | Yes | The new ordinal number. |
Response parameters
| Parameter | Type | Description |
| code | Integer | The status of a successful operation. |
Examples
- Example request
{ "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 }] } } - Example of a successful response
{ "code": 200, "message": "success" }
Execute a scene
Description
| Path | Version | Description | Logon required |
| /scene/fire | 1.0.2 | Execute a scene. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| sceneId | String | Yes | The ID of the scene to trigger. |
Response parameters
| Parameter | Type | Description |
| sceneId | String | The ID of the triggered scene. |
Examples
- Example request
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "groupId": null, "sceneId": "debf2dxxxx51496c2" } } - Example of a successful response
{ "code": 200, "data": "debf2dxxxx51496c2", "message": "success" }
Get a scene log list
Description
| Path | Version | Description | Logon required |
| /scene/log/list/get | 1.0.2 | Get a scene log list. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| pageNo | Integer | Yes | The requested page number. Must be greater than or equal to 1. |
| pageSize | Integer | Yes | The number of items to pull at a time. |
| nowTime | Long | Yes | The start time for the log query (in milliseconds). Refer to the scene log query method. |
To view logs from a different time period, you must start a new query. Specify the new time period, set pageNo to 1, and execute the query again. This method can query scene logs within a 15-day time range.
Response parameters
| Parameter | Type | Description |
| pageNo | Integer | The requested page number. Must be greater than or equal to 1. |
| pageSize | Integer | The number of items to pull at a time. |
| total | Integer | Total number. |
| logs | Array | The log list, returned in descending order of time. |
| logs.time | Long | Log time, a timestamp in milliseconds. |
| logs.icon | String | Scene icon. |
| logs.sceneId | String | Scene ID. |
| logs.id | String | Log ID. |
| logs.sceneName | String | Scene name. |
| logs.result | Integer | Execution result: 0 - Failed. 1 - Successful. |
Examples
- Example request
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "pageNo": 1, "pageSize": 5, "groupId": null, "nowTime": 1527129084824 } } - Example of a successful response
{ "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 failed log details
Description
| Path | Version | Description | Logon required |
| /scene/failedlog/get | 1.0.4 | Get failed log details. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| logId | String | Yes | The ID of the log to query. |
| sceneId | String | Yes | Scene ID. |
| time | Long | Yes | The logs.time returned by /scene/log/list/get, in milliseconds. |
| pageNo | Integer | Yes | The requested page number. The first page is 1. |
| pageSize | Integer | Yes | The number of items to pull at a time. |
Response parameters
| Parameter | Type | Description |
| total | Integer | Total number. |
| pageSize | Integer | The number of items to pull at a time. |
| pageNo | Integer | The requested page number. Must be greater than or equal to 1. |
| details | Array | None |
| details.productKey | String | A list of details for failed devices. |
| details.localizedProductName | String | Localized product information. |
| details.deviceName | String | Device name |
| details.aliasName | String | The name given to the device by the user. |
| details.failedReason | String | Error message. If the action is to set a property, the text rule is: {Product Name}-{Property Name}-{Property Value} execution failed. If the action is to call a service, the text rule is: {Product Name}-{Service Name} execution failed. |
| details.detail | String | The reason for the subscript annotation. |
| details.icon | String | Icon. |
Examples
- Example request
{ "id": "150xxxx4180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "pageNo": 1, "pageSize": 1000, "logId": "0bc19xxxx00056576d52bf", "sceneId": "d5edf3xxxx91b15e2028", "time": 1527091200000 } } - Example of a successful response
{ "code": 200, "data": { "details": [{ "detail": "light-hy - NightLightSwitch - Off1 Set device parameters", "deviceName": "hyxxxxhy", "failedReason": "device in scene's action is unbind", "productKey": "b1xxxxrm" }], "pageNo": 1, "pageSize": 1000 }, "message": "success" }
Get scene details
Description
| Path | Version | Description | Logon required |
| /scene/info/get | 1.0.5 | Get scene details. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| sceneId | String | Yes | The ID of the scene to query. |
| groupId | String | No | Scene type:
|
Response parameters
| Parameter | Type | Description |
| sceneId | String | Scene ID. |
| enable | Boolean | The status of the scene switch. Valid values:
|
| name | String | The name of the scene given by the user. |
| icon | String | Scene icon. |
| iconColor | String | The color of the scene icon. |
| description | String | A description of the scene. |
| triggersJson | Object | The JSON serialization of the complex object within the Trigger of an IFTTT rule. Used for frontend display. |
| conditions | Object | The condition object of the IFTTT rule. |
| caConditionsJson | Array | Since Scene Service 2.0. The JSON serialization of the complex object within the Condition of a CA rule. Used for frontend display. |
| actionsJson | String | The JSON serialization of the complex object within the Action. Used for frontend display. |
| sceneType | String | Since Scene Service 2.0. Scene rule: IFTTT or CA (default is IFTTT). |
| mode | String | Since Scene Service 2.0. The mode of the CA rule: all or any. |
| valid | Boolean | Indicates whether the scene is valid. |
Enable and disable a scene
Description
| Path | Version | Description | Logon required |
| /living/scene/switch | 1.0.0 | Enable/disable a scene automation. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| sceneId | String | Yes | Scene ID. |
| enable | Boolean | Yes | The status of the scene switch. Valid values:
|
Response parameters
Examples
- Example request
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": { "sceneId": "0c96536xxxxc5306a6657", "enable": true } } - Example of a successful response
{ "code": 200, "message": "success" }
Get a list of devices that support trigger/condition/action configurations for the current user
Description
| Path | Version | Description | Logon required | Notes |
| /scene/thing/list | 1.0.2 | Query for a list of devices that support T/C/A. | Yes. The client SDK must enable identity authentication. | Includes shared devices. |
Request parameters
| Parameter | Type | Required | Description |
| flowType | Integer | Yes | Flow type: 0 - trigger. 1 - condition. 2 - action. |
| pageNum | Integer | Yes | The page number for pagination, starting from 1. |
| pageSize | Integer | Yes | The page size for pagination. |
Response parameters
| Parameter | Type | Description |
| pageNo | Integer | The page number, starting from 1. |
| pageSize | Integer | The maximum number of items per page. |
| total | Long | Total number of records. |
| data | List | Device list. |
| Parameter | Type | Description |
| iotId | String | Device ID. |
| deviceName | String | Device name |
| productKey | String | Product key |
| nickName | String | Device nickname. |
| image | String | The URL of the category icon. |
Examples
- Example request
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "flowType": 0, "pageNum": 1, "pageSize": 20 } } - Example of a successful response
{ "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 functional properties that support trigger/condition/action configurations on a device
Description
| Path | Version | Description | Logon required |
| /iotid/scene/ability/list | 1.0.2 | Query for a list of features that support T/C/A on a device. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotId | String | Yes | Device ID. |
| flowType | Integer | Yes | Flow type: 0 - trigger. 1 - condition. 2 - action. |
Response parameters
| Parameter | Type | Description |
| name | String | Feature name. |
| identifier | String | Feature identifier. |
| categoryType | String | Category name. |
| type | Integer | Feature type: 1 - Property. 2 - Service. 3 - Event. |
Examples
- Example request
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "iotId": "45dc6fxxxx29f6974e5f7", "flowType": 0 } } - Example of a successful response
{ "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 | Query for a list of features that support T/C/A on a device and the corresponding TSL information. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotId | String | Yes | Device ID. |
| flowType | Integer | Yes | Flow type: 0 - trigger. 1 - condition. 2 - action. |
Response parameters
| Parameter | Type | Description |
| simplifyAbilityDTOs | List | List of feature definitions. |
| abilityDsl | JSONObject | Product feature TSL (for reference). |
| Parameter | Type | Description |
| name | String | Feature name. |
| identifier | String | Feature identifier. |
| categoryType | String | Category name. |
| type | Integer | Feature type: 1 - Property. 2 - Service. 3 - Event. |
Examples
- Example request
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.1", "iotToken": "token" }, "params": { "iotId": "45dc6fxxxx6974e5f7", "flowType": 0 } } - Example of a successful response
{ "code": 200, "data": { "simplifyAbilityDTOs":[{ "name": "Switch", "identifier": "switch", "categoryType": "xxxx", "type": 1 }], "abilityDsl": {} }, "message": "success" }
Create a scheduled timed scene
Description
| Path | Version | Description | User identity authentication required |
| /scene/timing/create | 1.0.2 | Create a scheduled timed scene for a device. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotId | String | Yes | Device ID. |
| enable | Boolean | Yes | true for on, false for off. |
| name | String | Yes | The name of the scene given by the user. |
| icon | String | Yes | Scene icon. |
| description | String | No | A description of the scene. |
| triggers | Object | No | The trigger object. |
| conditions | Object | No | The condition object. |
| actions | Array | Yes | Action object |
Response parameters
| Parameter | Type | Description |
| sceneId | String | The ID of the new scene. |
Examples
- Example request
{ "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" } } } - Example of a successful response
{ "code": 200, "data": "0c9653xxxx645c5306a6657", "message": "success" }
Update a scheduled timed scene
Description
| Path | Version | Description | User identity authentication required |
| /scene/timing/update | 1.0.2 | Update a scheduled timed scene for a device. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotId | String | Yes | Device ID. |
| sceneId | String | Yes | Scene ID. |
| enable | Boolean | Yes | true for on, false for off. |
| name | String | Yes | The name of the scene given by the user. |
| icon | String | Yes | Scene icon. |
| description | String | No | A description of the scene. |
| triggers | Object | No | The trigger object. |
| conditions | Object | No | Condition object |
| actions | Array | Yes | Target object |
Response parameters
| Parameter | Type | Description |
| sceneId | String | Scene ID. |
Examples
- Example request
{ "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" } } } - Example of a successful response
{ "code": 200, "data": "0c9653xxxx06a6657", "message": "success" }
Delete a scheduled timed scene
Description
| Path | Version | Description | User identity authentication required |
| /scene/timing/delete | 1.0.2 | Delete a timed scene. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotId | String | Yes | Device ID. |
| sceneId | String | Yes | Scene ID. |
Response parameters
| Parameter | Type | Description |
| sceneId | String | The ID of the deleted scene. |
Examples
- Example request
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.2", "iotToken": "token" }, "params": { "sceneId": "0c96xxxx306a6657", "iotId": "gaI0Cxxxx109b3700" } } - Example of a successful response
{ "code": 200, "data": "0c9653xxxx06a6657", "message": "success" }
Get scheduled timed scene details
Description
| Path | Version | Description | User identity authentication required |
| /scene/timing/info/get | 1.0.2 | Get timed scene details. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotId | String | Yes | Device ID. |
| sceneId | String | Yes | The ID of the scene to query. |
Response parameters
| Parameter | Type | Description |
| sceneId | String | Scene ID. |
| enable | Boolean | Scene switch: true - On. false - Off. |
| status | Integer | Scene runtime status: 1 - Running. 2 - Invalid. |
| name | String | The name of the scene given by the user. |
| icon | String | Scene icon. |
| triggers | Object | A string of the triggers object. The trigger object is defined below. |
| conditions | Object | A string of the conditions object. |
| actions | Array | A string of the actions object. |
Examples
- Example request
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.2", "iotToken": "token" }, "params": { "sceneId": "260de8xxxx4691be22", "iotId": "gaI0Cxxxx9b3700" } } - Example of a successful response
{ "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 timed scenes for a device
Description
| Path | Version | Description | User identity authentication required |
| /scene/timing/list/get | 1.0.2 | Query a list of timed scenes. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| iotId | String | Yes | Device ID. |
| pageNo | Integer | Yes | The page number. Must be greater than or equal to 1. |
| pageSize | Integer | Yes | The number of items per page. Must be between 1 and 50. |
Response parameters
| Parameter | Sub-parameter | Type | Description |
| total | Integer | Total number of items. | |
| pageNo | Integer | The page number, starting from 1. | |
| pageSize | Integer | The number of items per page. | |
| scenes | Array | Returns the entries on the current page. | |
| scenes.id | String | Scene ID. | |
| scene.status | Integer | The runtime status of the scene: 1 - Scene is online. 2 - Scene is offline. | |
| scene.enable | Boolean | The scene switch (the switch in the app): true - Scene is on. false - Scene is off. | |
| scene.icon | String | Scenario Icon Link | |
| scene.name | String | Scene name. | |
| scene.description | String | Scene description. |
Examples
- Example request
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.2", "iotToken": "token" }, "params": { "pageSize": 20, "pageNo": 1, "iotId": "zjoOvFZxxxx0c4dc00" } } - Example of a successful response
{ "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 scene details in batches
Description
| Path | Version | Description | User identity authentication required |
| /living/scene/batchget | 1.0.0 | Request scene information in batches. | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| sceneIdList | list | Yes | A list of scene IDs to query. |
Response parameters
| Parameter | Type | Description |
| sceneId | String | Scene ID. |
| enable | Boolean | Scene switch: true - On. false - Off. |
| name | String | The name of the scene given by the user. |
| icon | String | Scene icon. |
| triggers | String | A string of the triggers object. |
| conditions | String | A string of the conditions object. |
| actions | String | A string of the actions object. |
Examples
- Example request
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": {"sceneIdList":["b8fe2xxxx26b76c31"]} } - Example of a successful response
{ "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 | Push message to mobile phone action | Yes. The client SDK must enable identity authentication. |
Request parameters
| Parameter | Type | Required | Description |
| customData | CustomData | Yes | Push message model. |
| customData. message | String | Yes | The content of the message to push to the mobile phone. Up to 60 characters. |
| msgTag | String | Yes | Push message model. Default value: IlopBusiness_CustomMsg. |
Return parameters
Examples
- Example request
"actions": [ { "uri":"action/mq/send", "params":{ "customData":{ "message":"Power is on" }, "msgTag":"IlopBusiness_CustomMsg" } } ] - Example of a successful response
None.
Query scenes for smart widgets
Description
| Path | Version | Description | Logon required |
| /living/appwidget/list | 1.0.0 | Smart widget query. Used to query component information in the scene quick trigger widget of the app. | Yes |
Request parameters
Response parameters
| Parameter | Type | Description |
| id | String | Scene ID. |
| name | String | Scene name. |
| description | String | Scene description. |
| enable | Boolean | Indicates whether the scene is enabled. |
| icon | String | Scene icon. |
| iconColor | String | The color of the scene icon. |
| valid | Boolean | Indicates whether the scene is valid. |
Examples
- Example request
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": { } } - Example of a successful response
{ "code": 200, "message": "success" "data":[{ "id": "d5edf3xxxxb15e2028", "iconColor": "#19BBFF", "name": "Send notification to mobile phone", "description": " Description ", "enable": true }, { "id": "debf2dxxxx1496c2", "iconColor": "#FFBBFF", "name": "Turn on light", "description": "Description", "enable": false } ] }
Add scenes for smart widgets
Description
| Path | Version | Description | Logon required |
| /living/appwidget/create | 1.0.0 | Smart widget add. Used to add components in the scene quick trigger widget of the app. | Yes |
Request parameters
Response parameters
| Parameter | Type | Description |
| sceneIds | Array | A list of scene IDs. Up to 8 scenes. |
Examples
- Example request
{ "id": "1509086454180", "version": "1.0", "request": { "apiVer": "1.0.0", "iotToken": "token" }, "params": { "sceneIds":["d5edfxxxx5e2028","debfxxxx496c2"] } } - Example of a successful response
{ "code": 200, "message": "success" }
Create a scene in a home
Description
| Path | Version | Description | Logon required |
| /living/scene/create | 1.0.1 | Create a scene in a home. | Yes |
The platform provides a home space management service. You can use the related APIs to build a home space model for your app. The scene service also supports home spaces and provides the ability to manage scenes within a home.
After you use the home space service to create a home for an app user, the scenes that the user previously created are automatically assigned to this home. The app user must then use the home scene APIs to manage scenes. The following APIs cannot be used to access scenes in a home space:
- /scene/create
- /scene/info/get
Request parameters
| Parameter | Type | Required | Description |
| homeId | String | Yes | The unique identifier of the home where the scene is located. |
| catalogId | String | Yes | Used to classify scenes.
|
| enable | Boolean | Yes | Specifies whether to enable the scene upon creation. true indicates enable, and false indicates disable. |
| name | String | Yes | The name of the scene given by the user. |
| description | String | No | A description of the scene. |
| icon | String | Yes | The download link for the scene icon. |
| iconColor | String | Yes | The color of the scene icon, for example, #FFFFFF. |
| triggers | Object | No | The trigger object of the IFTTT rule. |
| conditions | Object | No | The condition object of the IFTTT rule. |
| caConditions | JSON Array | No | The condition object of the CA rule. |
| actions | JSON Array | Yes | The action object. |
| sceneType | String | No | The scene rule type. Valid values are IFTTT and CA. The default value is IFTTT. |
| mode | String | No | The mode of the CA rule.
|
Response parameters
| Parameter | Type | Description |
| sceneId | String | The ID of the created scene. |
Request example
{
"homeId": "testHomeId"
"catalogId":"1",
"enable":true,
"name":"testScene",
"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"
}Response example
{
"code": 200,
"data": "sceneId",
"message": "success"
}Update a scene in a home
Description
| Path | Version | Description | Logon required |
| /living/scene/update | 1.0.0 | Update scenario | Yes |
Request parameters
| Parameter | Type | Required | Description |
| catalogId | String | Yes | Used to classify scenes.
Note The catalogId is specified when the scene is created and cannot be modified afterward. You cannot change a manual scene to an automation scene by modifying the catalogId. |
| sceneId | String | Yes | Scene ID. |
| enable | Boolean | Yes | true indicates enable the scene. false indicates disable the scene. |
| name | String | Yes | The name of the scene. |
| icon | String | Yes | Scenario Icon URL |
| iconColor | String | Yes | The color of the scene icon. |
| description | String | No | A description of the scene. |
| triggers | Object | No | The trigger object of the IFTTT rule. |
| conditions | Object | No | The condition object of the IFTTT rule. |
| caConditions | Array | No | The condition object of the CA rule. |
| actions | Array | Yes | The action object. |
| sceneType | String | No | The scene rule type. Valid values are IFTTT and CA. The default value is IFTTT. |
| mode | String | No | The mode of the CA rule.
|
Response parameters
| Parameter | Type | Description |
| sceneId | String | The ID of the updated scene. |
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" : "3g3 10 * * 1,2,3,4",
"cronType" : "linux"
}
}
],
"sceneType" : "CA",
"icon" : "http:\\www.aliyundoc.com/***.png",
"sceneId" : "2420d2xxxxf93c54fc4e",
"catalogId" : "1",
"name" : "10:27 Mon Tue - Power Switch On",
"actions" : [
{
"uri" : "action\/device\/setProperty",
"params" : {
"iotId" : "uumR5xxxx00101",
"propertyName" : "PowerSwitch",
"propertyValue" : 1
}
}
]
}
} Response example
{
"code": 200,
"data": "bdc60bexxxxd617697",
"message": "success"
}
Delete a scene in a home
Description
| Path | Version | Description | Logon required |
| /living/scene/delete | 1.0.0 | Delete a scene. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| sceneId | String | Yes | Scene ID. |
Response parameters
| Parameter | Type | Description |
| sceneId | String | Scenario I: Deletion |
Request example
{
"id": "1509086454180",
"version": "1.0",
"request": {
"apiVer": "1.0.1",
"iotToken": "token"
},
"params": {
"sceneId": "0c965xxxx5306a6657",
"groupId": null
}
} Example of a successful response
{
"code": 200,
"data": "0c9653xxxx06a6657",
"message": "success"
}Query a list of scenes in a home
Description
| Path | Version | Description | Logon required |
| /living/scene/query | 1.0.1 | Query a list of scenes. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| homeId | String | Yes | The unique identifier of the home where the scene is located. |
| catalogId | String | Yes |
|
| pageNo | Integer | Yes | The page number. Must be greater than or equal to 1. |
| pageSize | Integer | Yes | The number of items per page. Must be between 1 and 50. |
Response parameters
| Parameter | Sub-parameter | Type | Description |
| total | Integer | Total number of items. | |
| pageNo | Integer | The page number, starting from 1. | |
| pageSize | Integer | The number of items per page. | |
| scenes | Array | Returns the entries on the current page. | |
| scenes.id | String | Scene ID. | |
| scene.status | Integer | The runtime status of the scene: 1 indicates the scene is online. 2 indicates the scene is offline. | |
| scene.enable | Boolean | The scene switch (the switch in the app): true - Scene is on. false - Scene is off. | |
| scene.icon | String | The link to the scene icon. | |
| scene.iconColor | String | The color of the scene icon. | |
| scene.name | String | Scene name. | |
| scene.description | String | Scene description. | |
| scene.valid | Boolean | Valid | |
| scene.catalogId | String | Type: null - Scene 1.0. 0 - Scene. 1 - Automation. |
Request example
{
"id": "1509086454180",
"version": "1.0",
"request": {
"apiVer": "1.0.1",
"iotToken": "token"
},
"params": {
"homeId": "testHomeId",
"catalogId": "1",
"pageSize": 20,
"pageNo": 1,
}
}Example of a successful response
{
"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,
"catalogId":"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,
"catalogId":"1"
}, {
"description": "fan-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,
"catalogId":"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,
"catalogId":"1"
}],
"total": 4
},
"message": "success"
}Change the sort order of items in a home scene list
Description
| Path | Version | Description | Logon required |
| /scene/list/reorder | 1.0.6 | Change the sort order of items in a scene list. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| homeId | String | Yes | The unique identifier of the home to which the scene belongs. |
| groupId | String | Yes |
|
| newOrders | Array | Yes | An array of scenes with changed ordinal numbers. |
| newOrders.sceneId | String | Yes | Scene ID. |
| newOrders.targetOrder | Integer | Yes | The position to which the scene needs to be adjusted. The ordinal number starts from 0. |
Response parameters
| Parameter | Type | Description |
| code | Integer | The status of a successful operation. |
Request example
{
"id": "1509086454180",
"version": "1.0",
"request": {
"apiVer": "1.0.1",
"iotToken": "token"
},
"params": {
"groupId": "1",
"newOrders": [{
"sceneId": "a596dexxxx9685d25",
"targetOrder": 2
}, {
"sceneId": "c1a8de4xxxxb473c3",
"targetOrder": 1
}]
}
}Example of a successful response
{
"code": 200,
"message": "success"
}Get home scene details
Description
| Path | Version | Description | Logon required |
| /living/scene/info/get | 1.0.0 | Get scene details. | Yes |
Request parameters
| Parameter | Type | Required | Description |
| sceneId | String | Yes | The ID of the scene to query. |
| catalogId | String | No |
|
Response parameters
| Parameter | Type | Description |
| id | String | Scene ID. |
| enable | Boolean | The status of the scene switch.
|
| name | String | The name of the scene given by the user. |
| description | String | A description of the scene. |
| icon | String | Scene icon. |
| iconColor | String | The color of the scene icon. |
| triggersJson | Object | The JSON serialization of the complex object within the Trigger of an IFTTT rule. Used for frontend display. |
| conditionsJson | Object | The condition object of the IFTTT rule. |
| caConditionsJson | Array | Since Scene Service 2.0. The JSON serialization of the complex object within the Condition of a CA rule. Used for frontend display. |
| actionsJson | String | The JSON serialization of the complex object within the Action. Used for frontend display. |
| sceneType | String | Since Scene Service 2.0. Scene rule: IFTTT or CA (default is IFTTT). |
| mode | String | Since Scene Service 2.0. The mode of the CA rule.
|
| valid | Boolean | Indicates whether the scene is valid. |
Request example
{
"id": "1509086454180",
"version": "1.0",
"request": {
"apiVer": "1.0.1",
"iotToken": "token"
},
"params": {
"catalogId": "0",
"sceneId": "debf2dxxxx51496c2"
}
}Response example
{
"code":200,
"data":{
"id":"testSceneId",
"name":"Test Scene Name",
"description":"This is a test scene",
"enable":true,
"icon":"https://www.aliyundoc.com/***.png",
"iconColor":"#FFFFFF",
"sceneId":"testSceneId",
"valid":true,
"triggersJson":"{\"items\":[{\"params\":{\"cron\":\"0 7 * * 1,2,3,4,5,6,7\",\"cronType\":\"linux\",\"timezoneID\":\"Asia/Shanghai\"},\"uri\":\"trigger/timer\"}],\"uri\":\"logical/or\"}",
"actionsJson":"[{\"uri\":\"action/device/setProperty\",\"params\":{\"propertyName\":\"PowerSwitch_2\",\"propertyValue\":1,\"iotId\":\"testDeviceIotId01\",\"productKey\":\"testProduct\",\"deviceName\":\"testDeviceName01\"}}]"
},
"message":"success"
}