Appearance
Create Automation
API Address:/v2/cep/enduserapi/automation/save
Request Method:POST
Request Data Type:application/json
Response Data Type:*/*
API Description:Create automation
Request Example:
javascript
{
"actions": [
{
"delayTime": 0,
"deviceKey": "",
"icon": "",
"id": 0,
"name": "",
"productKey": "",
"property": {
"code": "",
"compare": "",
"dataType": "",
"id": 0,
"name": "",
"subName": "",
"subType": "",
"type": "",
"unit": "",
"value": {}
},
"sceneId": "",
"sort": 0,
"type": 0
}
],
"automationId": 0,
"conditionType": 0,
"conditions": [
{
"deviceKey": "",
"icon": "",
"name": "",
"productKey": "",
"property": {
"code": "",
"compare": "",
"dataType": "",
"id": 0,
"name": "",
"subName": "",
"subType": "",
"type": "",
"unit": "",
"value": {}
},
"sort": 0,
"timer": {
"dayOfWeek": "",
"time": "",
"timeZone": "",
"type": 0
},
"type": 0
}
],
"fid": "",
"name": "",
"nameType": 0,
"precondition": {
"effectDate": "",
"effectDateType": 0,
"effectTimeType": 0,
"endTime": "",
"location": "",
"regionName": "",
"startTime": "",
"timeZone": ""
}
}
Request Parameters:
Parameter Name | Description | Request Type | Required | Data Type | Schema |
---|---|---|---|---|---|
cmd | cmd | body | true | Automation Info Request | Automation Info Request |
actions | Execution actions | true | array | Automation Execution Action | |
delayTime | Delay time in seconds | false | integer | ||
deviceKey | Device DK/Group ID | false | string | ||
icon | Device/Group/Scene icon | false | string | ||
id | false | integer | |||
name | Device/Group/Scene name | false | string | ||
productKey | Product PK/Group PK | false | string | ||
property | Device property | false | Thing Model Property | Thing Model Property | |
code | Thing model identifier | true | string | ||
compare | Comparison operator: > | >= | < | <= | == |
dataType | Data type. Supports: BOOL, ENUM, INT, FLOAT, DOUBLE, Available values: BOOL,DOUBLE,ENUM,FLOAT,INT | true | string | ||
id | Thing model function ID | true | integer | ||
name | Thing model name | true | string | ||
subName | false | string | |||
subType | false | string | |||
type | Thing model type | false | string | ||
unit | Thing model unit | false | string | ||
value | Thing model property comparison value | false | object | ||
sceneId | Scene ID | false | string | ||
sort | Execution action order, starts from 1 and increments | true | integer | ||
type | Execution action type. 1: Delay, 2: Device, 3: Group, 4: Scene | true | integer | ||
automationId | Automation ID | false | integer(int64) | ||
conditionType | Trigger type. 1: Meet any, 2: Meet all | true | integer(int32) | ||
conditions | Trigger conditions | true | array | Automation Trigger Condition | |
deviceKey | Device DK | false | string | ||
icon | Device/Group/Scene icon | false | string | ||
name | Device/Group/Scene name | false | string | ||
productKey | Product PK | false | string | ||
property | Device property | false | Thing Model Property | Thing Model Property | |
code | Thing model identifier | true | string | ||
compare | Comparison operator: > | >= | < | <= | == |
dataType | Data type. Supports: BOOL, ENUM, INT, FLOAT, DOUBLE, Available values: BOOL,DOUBLE,ENUM,FLOAT,INT | true | string | ||
id | Thing model function ID | true | integer | ||
name | Thing model name | true | string | ||
subName | false | string | |||
subType | false | string | |||
type | Thing model type | false | string | ||
unit | Thing model unit | false | string | ||
value | Thing model property comparison value | false | object | ||
sort | Condition order, starts from 1 and increments | true | integer | ||
timer | Condition time | false | Automation Trigger Condition Time | Automation Trigger Condition Time | |
dayOfWeek | Repeat cycle. Required when timer type is custom, 1,2,3...7 represent Monday to Sunday | false | string | ||
time | Scheduled execution time. Format: HH:mm | true | string | ||
timeZone | Time zone, format: +-HH:mm | true | string | ||
type | Timer type. 0: Once only, 1: Daily, 2: Custom | true | integer | ||
type | Trigger condition type. 0: Device, 1: Timer | true | integer | ||
fid | Home ID, required if home mode is enabled, otherwise not required | false | string | ||
name | Automation name | true | string | ||
nameType | Automation name generation method, 1: System generated, 2: User defined | true | integer(int32) | ||
precondition | Effective time | false | Automation Effective Time | Automation Effective Time | |
effectDate | Effective date. Not filled when effective date type is daily. Weekly: 1,2,3,...7 represent Monday to Sunday, Monthly: 1-31, Specific date: format MM-dd/MM-dd, e.g.: 12-19/12-21 | false | string | ||
effectDateType | Effective date type. 0: Daily, 1: Weekly, 2: Monthly, 3: Specific date | true | integer | ||
effectTimeType | Effective time type. 0: Day, 1: Night, 2: All day, 3: Specific time period | true | integer | ||
endTime | End time. Required when effective time type is all day or specific time period, format: HH:mm | false | string | ||
location | Coordinates. Longitude first followed by latitude, required when effective time type is day or night | false | string | ||
regionName | Region name | false | string | ||
startTime | Start time. Required when effective time type is all day or specific time period, format: HH:mm | false | string | ||
timeZone | Time zone, format: +-HH:mm | false | string | ||
Authorization | header | false | string |
Response Status:
Status Code | Description | Schema |
---|---|---|
200 | OK | ApiResult«long» |
201 | Created | |
401 | Unauthorized | |
403 | Forbidden | |
404 | Not Found |
Response Parameters:
Parameter Name | Description | Type | Schema |
---|---|---|---|
code | integer(int32) | integer(int32) | |
data | integer(int64) | integer(int64) | |
extMsg | string | ||
msg | string |
Response Example:
javascript
{
"code": 0,
"data": 0,
"extMsg": "",
"msg": ""
}