Automation Scene

Last Updated on : 2024-06-05 03:15:11download

API list

Action Description
automation.add Add an automation scene.
automation.edit Modify an automation scene.
automation.delete Delete an automation scene.
automation.listByHome Query automation scenes in a home.
automation.info Query an automation scene in a home.
automation.conditionsTrigger Trigger external conditions of an automation scene in a home.
automation.devicesByHome Query devices that support an automation scene in a home.
automation.weatherConditions Query weather conditions supported by an automation scene.
automation.linkageByHome Get linkage conditions supported by a home.
automation.linkageByDevice Get linkage conditions supported by a device.
automation.enable Enable an automation scene.
automation.disable Disable an automation scene.

Add an automation scene

API description

Add an automation scene to the specified home.

API endpoint

action: automation.add

Request parameter

Parameter name Type Description Required
home_id Long The ID of the user’s home. Yes
name String The name of the automation scene. Yes
background String The background image. Yes
conditions List The list of scene conditions. Yes
preconditions List The preconditions with the highest priority. No
actions List The list of actions. Yes
match_type Integer The matching type. Valid values:
  • 1: Trigger a scene when any condition is met.
  • 2: Trigger a scene when all conditions are met.
  • 3: Trigger a scene when the custom conditions are met. Set the logic operation parameter condition_rule.
Yes
condition_rule String Custom condition rules. This parameter is required when the value of match_type is 3. The custom condition rules follow the AND OR formula. Each condition is identified by order_num. For example,
order_num in condition_rule is 1, 2, and 3 in turn.
The business scenario is as follows: If you want to trigger an automation scene when conditions 1 and 2 are met simultaneously, or when condition 3 is met, then the expression is 1&&2||3.
No

Description of conditions

Parameter name Type Description Required
entity_type Integer The type of condition. Valid values:
  • Set entity_type to 1 to represent a device status condition.
  • Set entity_type to 15 to represent an external condition.
  • Set entityType to 3 to represent a weather condition.
  • Set entity_type to 6 to represent a scheduled task condition.
Yes
entity_id String The entity that performs the action.
  • When the value of entity_type is 1, the value of entity_id is the device ID. Required.
  • When the value of entity_type is 15, the value of entity_id is automatically generated by the system. In this case, you do not need to set the value.
  • When the value of entity_type is 3, the value of entity_id is the city ID.
  • When the value of entity_type is 6, the value of entity_id is timer.
No
display JSON Show the conditions. Yes
order_num Integer The serial number of the specified condition, starting from 1. Yes

Description of display in device status condition

Parameter name Type Description Required
code String The statusCode of the specified device. Yes
operator String The operator. For more information, see Mapping between code data types and operators. Yes
value String The value of the specified code. Yes

Description of display in external condition

Parameter name Type Description Required
code String The key of the specified external condition. Yes
operator String The operator. For more information, see Mapping between code data types and operators. Yes
value Object The code value for the key of the specified external condition. Yes

Description of display in weather condition

Parameter name Type Description Required
code String The key of the specified weather condition. For example, temp. For more information about all keys, see Query weather conditions supported by an automation scene. Yes
operator String The operator. For more information, see Mapping between code data types and operators. Yes
value String The code value for the key of the specified weather condition. Yes

Description of display in scheduled task condition

Parameter name Type Description Required
date String The date when a scheduled task is triggered, in the format of yyyyMMdd. For example, 20191125. Yes
loops String A 7-digit number that consists of 0 and 1. 0 represents an ineffective day and 1 represents an effective day. The first digit represents Sunday, followed by Monday to Saturday in sequence.
For example, 0011000 represents that the scheduled task takes effect on Tuesday and Wednesday each week.
Yes
time String The time when a scheduled task is triggered, in the format of 24-hour time. Example: 14:00. Yes
timezone_id String The time zone ID. Example: Asia/Shanghai. Yes

Description of preconditions

The preconditions. The scene can be run only when the preconditions are met. You can specify a time period as a precondition.

Parameter name Type Description Required
cond_type String Currently, you can only set the specified time period as a precondition. Valid value: timeCheck. Yes
display JSON Show the conditions. Yes

Description of display in precondition

Parameter name Type Description Required
start String The start time in the format of 24-hour time. Example: 10:00. Yes
end String The end time in the format of 24-hour time. Example: 22:00. Yes
loops String A 7-digit number that consists of 0 and 1. 0 represents an ineffective day and 1 represents an effective day. The first digit represents Sunday, followed by Monday to Saturday in sequence.
For example, 0011000 represents that the scheduled task takes effect on Tuesday and Wednesday each week.
Yes
timezone_id String The time zone ID. Example: Asia/Shanghai. Yes

Description of actions

  • Description of devices involved in actions
Parameter name Type Description Required
entity_id String The ID of the device that performs the specified action. Yes
executor_property JSON The property of the specified execution action. Yes
action_executor String The type of action. Valid value: dpIssue. Yes
  • Description of external actions
Parameter name Type Description Required
executor_property JSON A custom external action. Yes
action_executor String The type of action. Valid value: externalAction to represent an external action. Yes
  • Description of delay in actions
Parameter name Type Description Required
executor_property JSON The property of the specified execution action. Yes
action_executor String The type of action. Valid value: delay. Yes

Sample request

{
  "action": "automation.add",
  "params": {
    "home_id": 2422120,
    "name":"Automation Test",
    "background":"https://images.tuyacn.com/smart/rule/cover/bedroom.png",
    "conditions":[
      {
        "display":{
          "code":"switch_1",
          "operator":"==",
          "value":true
        },
        "entity_id":"vdevo158389535209173",
        "entity_type":1,
        "order_num":1
      }
    ],
    "actions":[
      {
        "action_executor":"dpIssue",
        "entity_id":"vdevo158348104789998",
        "executor_property":{
          "switch": true
        }
      }
    ],
    "match_type":1,
  }
}

Example of preconditions

{
    "preconditions":[
        {
            "display":{
                "start":"10:00",
                "end":"12:00",
                "loops":"0010000",
                "timezone_id":"Asia/Shanghai"
            },
            "cond_type":"timeCheck"
        }
    ]
}

Example of device status conditions

{
    "conditions":[
        {
            "display":{
                "code":"switch_1",
                "operator":"==",
                "value":true
            },
            "entity_id":"vdevo157259825422309",
            "entity_type":1,
            "order_num":1
        }
    ]
}

Example of external conditions

{
    "conditions":[
        {
            "display":{
                "code":"test",
                "operator":"==",
                "value":"test"
            },
            "entity_type":15,
            "order_num":1
        }
    ]
}

Example of weather conditions

{
  "conditions":[
        {
            "display":{
                "code":"temp",
                "operator":"==",
                "value":"20"
            },
            "entity_id":"10",
            "entity_type":3,
            "order_num":1
        }
    ]
}

Example of scheduled task conditions

{
  "conditions":[
        {
            "display":{
                "date":"20200301",
                "loops":"0000000",
                "time":"14:00",
                "timezone_id":"Asia/Shanghai"
            },
            "entity_id":"timer",
            "entity_type":6,
            "order_num":1
        }
    ]
}

Example of external actions

{
    "actions":[
        {
            "action_executor":"externalAction",
            "executor_property":{
              // Custom, to be pushed through the message queue
            }
        }
    ]
}

Response parameter

Parameter name Type Description
code Integer The response code.
success Boolean Indicates whether the operation is successful.
  • true: succeeded
  • false: failed
msg String The message that is returned if the request failed. The response is empty if the request is successful.
t Long The returned 13-digit timestamp.
result String The automation scene ID.

Sample response on success

{
    "success": true,
    "t": 1541072348540,
    "result":"53IYSXI3gEn2w3Oc"
}

Sample response on failure

{
    "success": false,
    "code": 1100,
    "msg": "param is empty",
    "t": 1540954683193
}

Mapping between code data types and operators

type operator Description
Boolean “==”
Integer “>”,“==”,“<”
Enum “==”

Modify an automation scene

API description

Modify a scene under the specified home.

API endpoint

action: automation.edit

Request parameter

Parameter name Type Description Required
home_id Long The ID of the user’s home. Yes
automation_id String The automation scene ID. Yes
name String The name of the automation scene. Yes
background String The background image. Yes
conditions List The list of scene conditions. Yes
preconditions List The preconditions with the highest priority. No
actions List The list of actions. Yes
match_type Integer The matching type. Valid values:
  • 1: Trigger a scene when any condition is met.
  • 2: Trigger a scene when all conditions are met.
  • 3: Trigger a scene when the custom conditions are met. Set the logic operation parameter condition_rule.
Yes
condition_rule String Custom condition rules. This parameter is required when the value of match_type is 3. The custom condition rules follow the AND OR formula. Each condition is identified by order_num. For example, order_num in condition_rule is 1, 2, and 3 in turn.
The business scenario is as follows: If you want to trigger an automation scene when conditions 1 and 2 are met simultaneously, or when condition 3 is met, then the expression is 1&&2||3.
No

Description of conditions

Parameter name Type Description Required
entity_type Integer The type of condition. Valid values:
  • Set entity_type to 1 to represent a device status condition.
  • Set entity_type to 15 to represent an external condition.
  • Set entityType to 3 to represent a weather condition.
  • Set entity_type to 6 to represent a scheduled task condition.
Yes
entity_id String The entity that performs the action.
  • When the value of entity_type is 1, the value of entity_id is the device ID. Required.
  • When the value of entity_type is 15, the value of entity_id is automatically generated by the system. In this case, you do not need to set the value.
  • When the value of entity_type is 3, the value of entity_id is the city ID.
  • When the value of entity_type is 6, the value of entity_id is timer.
No
display JSON Show the conditions. Yes
order_num Integer The serial number of the specified condition, starting from 1. Yes

Description of display in device status condition

Parameter name Type Description Required
code String The statusCode of the specified device. Yes
operator String The operator. For more information, see Mapping between code data types and operators. Yes
value String The value of the specified code. Yes

Description of display in external condition

Parameter name Type Description Required
code String The key of the specified external condition. Yes
operator String The operator. For more information, see Mapping between code data types and operators. Yes
value String The code value for the key of the specified external condition. Yes

Description of display in weather condition

Parameter name Type Description Required
code String The key of the specified weather condition. For example, temp. Yes
operator String The operator. For more information, see Mapping between code data types and operators. Yes
value Object The code value for the key of the specified weather condition. Yes

Description of display in scheduled task condition

Parameter name Type Description Required
date String The date when a scheduled task is triggered, in the format of yyyyMMdd. For example, 20191125. Yes
loops String A 7-digit number that consists of 0 and 1. 0 represents an ineffective day and 1 represents an effective day. The first digit represents Sunday, followed by Monday to Saturday in sequence.
For example, 0011000 represents that the scheduled task takes effect on Tuesday and Wednesday each week.
Yes
time String The time when a scheduled task is triggered, in the format of 24-hour time. Example: 14:00. Yes
timezone_id String The time zone ID. Example: Asia/Shanghai. Yes

Description of preconditions

The preconditions. The scene can be run only when the preconditions are met. You can specify a time period as a precondition.

Parameter name Type Description Required
cond_type String Currently, you can only set the specified time period as a precondition. Valid value: timeCheck. Yes
display JSON Show the conditions. Yes

Description of display in precondition

Parameter name Type Description Required
start String The start time in the format of 24-hour time. Example: 10:00. Yes
end String The end time in the format of 24-hour time. Example: 22:00. Yes
loops String A 7-digit number that consists of 0 and 1. 0 represents an ineffective day and 1 represents an effective day. The first digit represents Sunday, followed by Monday to Saturday in sequence.
For example, 0011000 represents that the scheduled task takes effect on Tuesday and Wednesday each week.
Yes
timezone_id String The time zone ID. Example: Asia/Shanghai. Yes

Description of actions

  • Description of devices involved in actions
Parameter name Type Description Required
entity_id String The ID of the device that performs the specified action. Yes
executor_property JSON The property of the specified execution action. Yes
action_executor String The type of action. Valid value: dpIssue. Yes
  • Description of external actions
Parameter name Type Description Required
executor_property JSON A custom external action. Yes
action_executor String The type of action. Valid value: externalAction to represent an external action. Yes
  • Description of delay in actions
Parameter name Type Description Required
executor_property JSON The property of the specified execution action. Yes
action_executor String The type of action. Valid value: delay. Yes

Sample request

{
  "action": "automation.edit",
  "params": {
    "home_id": 2422120,
    "automation_id": "53IYSXI3gEn2w3Oc",
    "name":"Automation Test",
    "background":"https://images.tuyacn.com/smart/rule/cover/bedroom.png",
    "conditions":[
      {
        "display":{
          "code":"switch_1",
          "operator":"==",
          "value":true
        },
        "entity_id":"vdevo158389535209173",
        "entity_type":1,
        "order_num":1
      }
    ],
    "actions":[
      {
        "action_executor":"dpIssue",
        "entity_id":"vdevo158348104789998",
        "executor_property":{
          "switch": true
        }
      }
    ],
    "match_type":1,
  }
}

Example of preconditions

{
    "preconditions":[
        {
            "display":{
                "start":"10:00",
                "end":"12:00",
                "loops":"0000000",
                "timezone_id":"Asia/Shanghai"
            },
            "cond_type":"timeCheck"
        }
    ]
}

Example of device status conditions

{
    "conditions":[
        {
            "display":{
                "code":"switch_1",
                "operator":"==",
                "value":true
            },
            "entity_id":"vdevo157259825422309",
            "entity_type":1,
            "order_num":1
        }
    ]
}

Example of external conditions

{
    "conditions":[
        {
            "display":{
                "code":"test",
                "operator":"==",
                "value":"test"
            },
            "entity_type":15,
            "order_num":1
        }
    ]
}

Example of weather conditions

{
  "conditions":[
        {
            "display":{
                "code":"temp",
                "operator":"==",
                "value":"20"
            },
            "entity_id":"10",
            "entity_type":3,
            "order_num":1
        }
    ]
}

Example of scheduled task conditions

{
  "conditions":[
        {
            "display":{
                "date":"20200301",
                "loops":"0000000",
                "time":"14:00",
                "timezone_id":"Asia/Shanghai"
            },
            "entity_id":"timer",
            "entity_type":6,
            "order_num":1
        }
    ]
}

Example of external actions

{
    "actions":[
        {
            "action_executor":"externalAction",
            "executor_property":{
              // Custom, to be pushed through the message queue
            }
        }
    ]
}

Example of delay actions

{
   "action_executor":"delay",
   "executor_property":{
    "hours":"0",
    "minutes": "0",
    "seconds": "5"
   }

}

Response parameter

Parameter name Type Description
code Integer The response code.
success Boolean Indicates whether the operation is successful.
  • true: succeeded
  • false: failed
msg String The message that is returned if the request failed. The response is empty if the request is successful.
t Long The returned 13-digit timestamp.
result Boolean true is returned when the operation is successful.

Sample response on success

{
    "success": true,
    "t": 1541072348540,
    "result": true
}

Sample response on failure

{
    "success": false,
    "code": 1100,
    "msg": "param is empty",
    "t": 1540954683193
}

Mapping between code data types and operators

type operator Description
Boolean “==”
Integer “>”,“==”,“<”
Enum “==”

Delete an automation scene

API description

Delete the specified automation scene from a home.

API endpoint

action: automation.delete

Request parameter

Parameter name Type Description Required
home_id Long The ID of the user’s home. Yes
automation_id String The automation scene ID. Yes

Sample request

{
  "action": "automation.delete",
  "params": {
    "home_id": 2422120,
    "automation_id": "53IYSXI3gEn2w3Oc"
  }
}

Response parameter

Parameter name Type Description
code Integer The response code.
success Boolean Indicates whether the operation is successful.
  • true: succeeded
  • false: failed
  • msg String The message that is returned if the request failed. The response is empty if the request is successful.
    t Long The returned 13-digit timestamp.
    result Boolean Indicates whether the automation scene is deleted successfully. true is returned when the operation is successful.

    Sample response on success

    {
        "success": true,
        "t": 1541072348540,
        "result":true
    }
    

    Sample response on failure

    {
        "success": false,
        "code": 1100,
        "msg": "param is empty",
        "t": 1540954683193
    }
    

    Query automation scenes in a home

    API description

    Query a list of automation scenes in a home.

    API endpoint

    action: automation.listByHome
    

    Request parameter

    Parameter name Type Description Required
    home_id Long The ID of the user’s home. Yes

    Sample request

    {
      "action": "automation.listByHome",
      "params": {
        "home_id": 2422120
      }
    }
    

    Response parameter

    Parameter name Type Description
    code Integer The response code.
    success Boolean Indicates whether the operation is successful.
  • true: succeeded
  • false: failed
  • msg String The message that is returned if the request failed. The response is empty if the request is successful.
    t Long The returned 13-digit timestamp.
    result List The returned result.

    Description of result

    Parameter name Type Description
    automation_id String The automation scene ID.
    name String The name of the automation scene.
    background String The background image.
    conditions List The list of scene conditions.
    actions List The list of actions.
    match_type Integer The matching type. Valid values:
  • 1: Trigger a scene when any condition is met.
  • 2: Trigger a scene when all conditions are met.
  • Description of conditions

    Parameter name Type Description Required
    entity_type Integer The type of entity. Currently, only entity_type=1 is supported. Yes
    entity_id String The entity that performs the action. A device is currently supported. Set the value to a device ID. Yes
    display JSON Display the condition. Currently, only entity_type=1 is supported. Yes
    order_num Integer The serial number of the specified condition, starting from 1. Yes

    Description of display

    Parameter name Type Description Required
    code String The statusCode of the specified device. Yes
    operator String The operator. For more information, see Mapping between code data types and operators. Yes
    value String The value of the specified code. Yes

    Description of actions

    Parameter name Type Description Required
    entity_id String The entity that performs the action. A device is currently supported. Set the value to a device ID. Yes
    executor_property JSON The property of the specified execution action. Yes
    action_executor String The type of action. Valid value: dpIssue. Yes

    Sample response on success

    {
        "result":[
            {
                "actions":[
                    {
                        "action_executor":"dpIssue",
                        "entity_id":"vdevo157259825422309",
                        "executor_property":{
                            "switch_1":true
                        }
                    }
                ],
                "automation_id":"p2aWOkEOe2RzATHL",
                "background":"https://images.tuyacn.com/smart/rule/cover/bedroom.png",
                "conditions":[
                    {
                        "display":{
                            "code":"switch_1",
                            "operator":"==",
                            "value":true
                        },
                        "entity_id":"vdevo157259825422309",
                        "entity_type":1,
                        "order_num":1
                    }
                ],
                "match_type":1,
                "name":"Automation Test",
            },
            {
                "automation_id":"L07BQVabdqwFPT9K",
                "background":"https://images.tuyacn.com/smart/rule/cover/house6.png",
                "conditions":[
                    {
                        "display":{
                            "code":"battery_percentage",
                            "operator":"<",
                            "value":255
                        },
                        "entity_id":"vdevo156958314001174",
                        "entity_type":1,
                        "order_num":1
                    }
                ],
                "match_type":1,
                "name":"Automation Test 1",
            }
        ],
        "success":true,
        "t":1572936751228
    }
    

    Sample response on failure

    {
        "success": false,
        "code": 1100,
        "msg": "param is empty",
        "t": 1540954683193
    }
    

    Mapping between code data types and operators

    type operator Description
    Boolean “==”
    Integer “>”,“==”,“<”
    Enum “==”

    Query an automation scene in a home

    API description

    Query an automation scene in a home.

    API endpoint

    action: automation.info
    

    Request parameter

    Parameter name Type Description Required
    home_id Long The ID of the user’s home. Yes
    automation_id String The automation scene ID. Yes

    Sample request

    {
      "action": "automation.info",
      "params": {
        "home_id": 2422120,
        "automation_id":"L07BQVabdqwFPT9K"
      }
    }
    

    Response parameter

    Parameter name Type Description
    code Integer The response code.
    success Boolean Indicates whether the operation is successful.
  • true: succeeded
  • false: failed
  • msg String The message that is returned if the request failed. The response is empty if the request is successful.
    t Long The returned 13-digit timestamp.
    result List The returned result.

    Description of result

    Parameter name Type Description
    automation_id String The automation scene ID.
    name String The name of the automation scene.
    background String The background image.
    conditions List The list of scene conditions.
    actions List The list of actions.
    match_type Integer The matching type. Valid values:
  • 1: Trigger a scene when any condition is met.
  • 2: Trigger a scene when all conditions are met.
  • Description of conditions

    Parameter name Type Description Required
    entity_type Integer The type of entity. Currently, only entity_type=1 is supported. Yes
    entity_id String The entity that performs the action. A device is currently supported. Set the value to a device ID. Yes
    display JSON Display the condition. Currently, only entity_type=1 is supported. Yes
    order_num Integer The serial number of the specified condition, starting from 1. Yes

    Description of display

    Parameter name Type Description Required
    code String The statusCode of the specified device. Yes
    operator String The operator. For more information, see Mapping between code data types and operators. Yes
    value String The value of the specified code. Yes

    Description of actions

    Parameter name Type Description Required
    entity_id String The entity that performs the action. A device is currently supported. Set the value to a device ID. Yes
    executor_property JSON The property of the specified execution action. Yes
    action_executor String The type of action. Valid value: dpIssue. Yes

    Sample response on success

    {
        "result":[
            {
                "actions":[
                    {
                        "action_executor":"dpIssue",
                        "entity_id":"vdevo157259825422309",
                        "executor_property":{
                            "switch_1":true
                        }
                    }
                ],
                "automation_id":"p2aWOkEOe2RzATHL",
                "background":"https://images.tuyacn.com/smart/rule/cover/bedroom.png",
                "conditions":[
                    {
                        "display":{
                            "code":"switch_1",
                            "operator":"==",
                            "value":true
                        },
                        "entity_id":"vdevo157259825422309",
                        "entity_type":1,
                        "order_num":1
                    }
                ],
                "match_type":1,
                "name":"Automation Test",
            },
            {
                "automation_id":"L07BQVabdqwFPT9K",
                "background":"https://images.tuyacn.com/smart/rule/cover/house6.png",
                "conditions":[
                    {
                        "display":{
                            "code":"battery_percentage",
                            "operator":"<",
                            "value":255
                        },
                        "entity_id":"vdevo156958314001174",
                        "entity_type":1,
                        "order_num":1
                    }
                ],
                "match_type":1,
                "name":"Automation Test 1",
            }
        ],
        "success":true,
        "t":1572936751228
    }
    

    Sample response on failure

    {
        "success": false,
        "code": 1100,
        "msg": "param is empty",
        "t": 1540954683193
    }
    

    Mapping between code data types and operators

    type operator Description
    Boolean “==”
    Integer “>”,“==”,“<”
    Enum “==”

    Trigger external conditions of automation scene

    API description

    Trigger external conditions of an automation scene in a home.

    API endpoint

    action: automation.conditionsTrigger
    

    Request parameter

    Parameter name Type Description Required
    home_id Long The ID of the user’s home. Yes
    automation_id String The automation scene ID. Yes
    conditions List The list of scene conditions. Yes

    Description of conditions

    Parameter name Type Description Required
    entity_id String The ID of the specified external condition. Yes
    display JSON The condition that triggers an automation scene. Yes

    Description of display

    Parameter name Type Description Required
    code String The statusCode of the specified device. Yes
    value String The value of the specified code. Yes

    Sample request

    {
      "action": "automation.conditionsTrigger",
      "params": {
        "home_id": 2422120,
        "automation_id": "53IYSXI3gEn2w3Oc",
        "conditions": [
        {
            "entity_id": "c9a5a524-d973-4b59-9390-0dcda0f172ec",
            "display": {
                "code":"test",
                "value":"test"
            }
        }]
      }
    }
    

    Response parameter

    Parameter name Type Description
    code Integer The response code. For more information, see Error codes section. It is empty if the request is successful.
    success Boolean Indicates whether the operation is successful.
  • true: succeeded
  • false: failed
  • msg String The message that is returned if the request failed. The response is empty if the request is successful.
    t Long The returned 13-digit timestamp.
    result String true is returned when the operation is successful.

    Sample response on success

    {
        "success": true,
        "t": 1541072348540,
        "result": true
    }
    

    Sample response on failure

    {
        "success": false,
        "code": 1100,
        "msg": "param is empty",
        "t": 1540954683193
    }
    

    Query devices supporting automation scene

    API description

    Query devices that support an automation scene in a home.

    API endpoint

    action: automation.devicesByHome
    

    Request parameter

    Parameter name Type Description Required
    home_id Long The ID of the user’s home. Yes
    type String The supported content. Valid values:
  • condition: condition
  • action: action
    Both conditions and actions are supported if you do not set this parameter.
  • No

    Sample request

    {
      "action": "automation.devicesByHome",
      "params": {
        "home_id": 2422120,
        "type": "condition"
      }
    }
    

    Response parameter

    Parameter name Type Description
    code Integer The response code. For more information, see Error codes. It is empty if the request is successful.
    success Boolean Indicates whether the operation is successful.
  • true: succeeded
  • false: failed
  • msg String The message that is returned if the request failed. The response is empty if the request is successful.
    t Long The returned 13-digit timestamp.
    result List The returned result.

    Description of result

    Parameter name Type Description
    device_id String The device ID.
    uuid String The universally unique identifier (UUID) of the specified device.
    name String The name.
    home_id String The home ID.
    product_id String The product ID (PID).

    Sample response on success

    {
        "result":[
            {
                "id":"vedo1234456",
                "uuid":"asdfghnbvcxwert",
            "name":"Test Device",
                "product_id":"r4567543dvbn",
                "home_id":"2422120"
            }
        ],
        "success":true,
        "t":1572936751228
    }
    
    

    Sample response on failure

    {
        "success": false,
        "code": 1100,
        "msg": "param is empty",
        "t": 1540954683193
    }
    

    Query weather conditions supported by automation scene

    API description

    Query various weather conditions supported by an automation scene.

    API endpoint

    action: automation.weatherConditions
    

    Request parameter
    None

    Sample request

    {
      "action": "automation.weatherConditions"
    }
    

    Response parameter

    Parameter name Type Description
    code Integer The response code. For more information, see Error codes. It is empty if the request is successful.
    success Boolean Indicates whether the operation is successful.
  • true: succeeded
  • false: failed
  • msg String The message that is returned if the request failed. The response is empty if the request is successful.
    t Long The returned 13-digit timestamp.
    result List The returned result.

    Description of result

    Parameter name Type Description
    category String The category.
    category_name String The name of the specified category.
    operators String The operator.
    property JSON The property of the specified category.

    Sample response on success

    {
        "result":[
                {
                    "category":"temp",
                    "category_name":"Temperature",
                    "operators":"[\"<\",\"==\",\">\"]",
                    "property":{
                        "unit": "℃",
                        "min": -40,
                        "max": 40,
                        "step": 1,
                        "type": "value"
                    },
                }
        ],
        "success":true,
        "t":1572936751228
    }
    
    

    Sample response on failure

    {
        "success": false,
        "code": 1100,
        "msg": "param is empty",
        "t": 1540954683193
    }
    

    Get supported linkage conditions

    API description

    Get the standard data points of linkage conditions or execution actions based on the home ID.

    API endpoint

    action: automation.linkageByHome
    

    Request parameter

    Parameter name Type Description Required
    home_id String The home ID. Yes

    Sample request

    {
      "action": "automation.linkageByHome",
      "params": {
        "home_id": 2422120
      }
    }
    

    Response parameter

    Parameter name Type Description
    code Integer The response code.
    success Boolean Indicates whether the operation is successful.
  • true: succeeded
  • false: failed
  • msg String The message that is returned if the request failed. The response is empty if the request is successful.
    t Long The returned 13-digit timestamp.
    result List The returned result.

    Description of result

    Parameter name Type Description
    device_id String The automation scene ID.
    functions List The identifier of a standard data point that indicates an action.
    status List The identifier of specified data point status that triggers a scene.

    Description of functions

    Parameter name Type Description
    code String The identifier of the standard data point sent from the cloud to a device.
    name String The name of the data point.
    type String The type of data point sent. Valid values: Boolean, Integer, and Enum.
    values JSON The value range of the specified data point.

    Description of status

    Parameter name Type Description
    code String The identifier of a standard data point status reported by a device to the cloud.
    name String The name of the data point.
    type String The type of data point reported. Valid values: Boolean, Integer, and Enum.
    values JSON The value range of the specified data point.

    Sample response on success

    {
        "success": true,
        "t": 1541072348540,
        "result": [
                    {
                      "device_id": "0120090568c63a89cb34",
                      "functions": [
                          {
                              "name": "Brightness",
                              "code": "bright_value",
                              "type": "Integer",
                              "values": {
                                            "max":255,
                                            "min":25,
                                            "scale":0,
                                            "step":1,
                                            "type":"value",
                                            "unit":""
                                        }
                          },
                          {
                            "name": "Switch",
                            "code": "switch_led",
                            "type": "Boolean"
                        }
                      ],
                      "status": [
                          {
                              "name": "Mode",
                              "code": "work_mode",
                              "type": "Enum",
                              "values":  {
                                            "range": [
                                                        "white",
                                                        "colour",
                                                        "scene",
                                                        "scene_1",
                                                        "scene_2",
                                                        "scene_3",
                                                        "scene_4"
                                                    ],
                                             "type": "Enum"
                                        }
                          }
                      ]
                    }
                ]
    }
    

    Sample response on failure

    {
        "success": false,
        "code": 1100,
        "msg": "param is empty",
        "t": 1540954683193
    }
    

    Get supported linkage conditions

    API description

    Get the standard data points of linkage conditions or task actions based on the device ID.

    API endpoint

    action: automation.linkageByDevice
    

    Request parameter

    Parameter name Type Description Required
    device_id String The device ID. Yes

    Sample request

    {
      "action": "automation.linkageByDevice",
      "params": {
        "device_id": "vdevo158348104789998"
      }
    }
    

    Response parameter

    Parameter name Type Description
    code Integer The response code.
    success Boolean Indicates whether the operation is successful.
  • true: succeeded
  • false: failed
  • msg String The message that is returned if the request failed. The response is empty if the request is successful.
    t Long The returned 13-digit timestamp.
    result Object The returned result.

    Description of result

    Parameter name Type Description
    device_id String The device ID.
    functions List The identifier of a standard data point that indicates an action.
    status List The identifier of specified data point status that triggers a scene.

    Description of functions

    Parameter name Type Description
    code String The identifier of the standard data point sent from the cloud to a device.
    name String The name of the data point.
    type String The type of data point sent. Valid values: Boolean, Integer, and Enum.
    values JSON The value range of the specified data point.

    Description of status

    Parameter name Type Description
    code String The identifier of a standard data point status reported by a device to the cloud.
    name String The name of the data point.
    type String The type of data point reported. Valid values: Boolean, Integer, and Enum.
    values JSON The value range of the specified data point.

    Sample response on success

    {
        "success": true,
        "t": 1541072348540,
        "result": {
                      "device_id": "0120090568c63a89cb34",
                      "functions": [
                          {
                              "name": "Brightness",
                              "code": "bright_value",
                              "type": "Integer",
                              "values": {
                                            "max":255,
                                            "min":25,
                                            "scale":0,
                                            "step":1,
                                            "type":"Integer",
                                            "unit":""
                                        }
                          },
                          {
                            "name": "Switch",
                            "code": "switch_led",
                            "type": "Boolean",
                            "values": {
                                        "type": "Boolean"
                                      }
                        }
                      ],
                      "status": [
                          {
                              "name": "Mode",
                              "code": "work_mode",
                              "type": "Enum",
                              "values":  {
                                            "range": [
                                                        "white",
                                                        "colour",
                                                        "scene",
                                                        "scene_1",
                                                        "scene_2",
                                                        "scene_3",
                                                        "scene_4"
                                                    ],
                                             "type": "Enum"
                                        }
                          }
                      ]
                }
    }
    

    Sample response on failure

    {
        "success": false,
        "code": 1100,
        "msg": "param is empty",
        "t": 1540954683193
    }
    

    Enable an automation scene

    API description

    Enable an automation scene.

    API endpoint

    action: automation.enable
    

    Request parameter

    Parameter name Type Description Required
    home_id Long The home ID. Yes
    automation_id String The automation scene ID. Yes

    Return parameters

    Parameter name Type Description
    code Integer The response code. For more information, see Error codes. It is empty if the request is successful.
    success Boolean Indicates whether the operation is successful.
  • true: succeeded
  • false: failed
  • msg String The message that is returned if the request failed. The response is empty if the request is successful.
    t Long The returned 13-digit timestamp.
    result Boolean The returned result.

    Sample request

    {
      "action": "automation.enable",
      "params": {
        "home_id": 2422120,
        "automation_id": "53IYSXI3gEn2w3Oc"
      }
    }
    

    Sample response

    {
        "success": true,
        "t": 1541072348540,
        "result": true
    }
    

    Error codes

    The following table lists the error codes that might be returned when you make the API request. For more error codes, see Global Error Codes.

    Error code Description
    500 A system error has occurred while processing your request.

    Disable an automation scene

    API description

    Disable an automation scene

    API endpoint

    action: automation.disable
    

    Request parameters

    Parameter name Type Description Required
    home_id Long The home ID. Yes
    automation_id String The automation scene ID. Yes

    Return parameter

    Parameter name Type Description
    code Integer The response code. For more information, see Error codes. It is empty if the request is successful.
    success Boolean Indicates whether the operation is successful.
  • true: succeeded
  • false: failed
  • msg String The message that is returned if the request failed. The response is empty if the request is successful.
    t Long The returned 13-digit timestamp.
    result Boolean The returned result.

    Sample request

    {
      "action": "automation.disable",
      "params": {
        "home_id": 2422120,
        "automation_id": "53IYSXI3gEn2w3Oc"
      }
    }
    

    Sample response

    {
        "success": true,
        "t": 1541072348540,
        "result": true
    }
    

    Error codes

    The following table lists the error codes that might be returned when you make the API request. For more error codes, see Global Error Codes.

    Error code Description
    500 A system error has occurred while processing your request.