Skip to content

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 NameDescriptionRequest TypeRequiredData TypeSchema
cmdcmdbodytrueAutomation Info RequestAutomation Info Request
  actionsExecution actionstruearrayAutomation Execution Action
    delayTimeDelay time in secondsfalseinteger
    deviceKeyDevice DK/Group IDfalsestring
    iconDevice/Group/Scene iconfalsestring
    idfalseinteger
    nameDevice/Group/Scene namefalsestring
    productKeyProduct PK/Group PKfalsestring
    propertyDevice propertyfalseThing Model PropertyThing Model Property
      codeThing model identifiertruestring
      compareComparison operator: >>=<<===
      dataTypeData type. Supports: BOOL, ENUM, INT, FLOAT, DOUBLE, Available values: BOOL,DOUBLE,ENUM,FLOAT,INTtruestring
      idThing model function IDtrueinteger
      nameThing model nametruestring
      subNamefalsestring
      subTypefalsestring
      typeThing model typefalsestring
      unitThing model unitfalsestring
      valueThing model property comparison valuefalseobject
    sceneIdScene IDfalsestring
    sortExecution action order, starts from 1 and incrementstrueinteger
    typeExecution action type. 1: Delay, 2: Device, 3: Group, 4: Scenetrueinteger
  automationIdAutomation IDfalseinteger(int64)
  conditionTypeTrigger type. 1: Meet any, 2: Meet alltrueinteger(int32)
  conditionsTrigger conditionstruearrayAutomation Trigger Condition
    deviceKeyDevice DKfalsestring
    iconDevice/Group/Scene iconfalsestring
    nameDevice/Group/Scene namefalsestring
    productKeyProduct PKfalsestring
    propertyDevice propertyfalseThing Model PropertyThing Model Property
      codeThing model identifiertruestring
      compareComparison operator: >>=<<===
      dataTypeData type. Supports: BOOL, ENUM, INT, FLOAT, DOUBLE, Available values: BOOL,DOUBLE,ENUM,FLOAT,INTtruestring
      idThing model function IDtrueinteger
      nameThing model nametruestring
      subNamefalsestring
      subTypefalsestring
      typeThing model typefalsestring
      unitThing model unitfalsestring
      valueThing model property comparison valuefalseobject
    sortCondition order, starts from 1 and incrementstrueinteger
    timerCondition timefalseAutomation Trigger Condition TimeAutomation Trigger Condition Time
      dayOfWeekRepeat cycle. Required when timer type is custom, 1,2,3...7 represent Monday to Sundayfalsestring
      timeScheduled execution time. Format: HH:mmtruestring
      timeZoneTime zone, format: +-HH:mmtruestring
      typeTimer type. 0: Once only, 1: Daily, 2: Customtrueinteger
    typeTrigger condition type. 0: Device, 1: Timertrueinteger
  fidHome ID, required if home mode is enabled, otherwise not requiredfalsestring
  nameAutomation nametruestring
  nameTypeAutomation name generation method, 1: System generated, 2: User definedtrueinteger(int32)
  preconditionEffective timefalseAutomation Effective TimeAutomation Effective Time
    effectDateEffective 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-21falsestring
    effectDateTypeEffective date type. 0: Daily, 1: Weekly, 2: Monthly, 3: Specific datetrueinteger
    effectTimeTypeEffective time type. 0: Day, 1: Night, 2: All day, 3: Specific time periodtrueinteger
    endTimeEnd time. Required when effective time type is all day or specific time period, format: HH:mmfalsestring
    locationCoordinates. Longitude first followed by latitude, required when effective time type is day or nightfalsestring
    regionNameRegion namefalsestring
    startTimeStart time. Required when effective time type is all day or specific time period, format: HH:mmfalsestring
    timeZoneTime zone, format: +-HH:mmfalsestring
Authorizationheaderfalsestring

Response Status:

Status CodeDescriptionSchema
200OKApiResult«long»
201Created
401Unauthorized
403Forbidden
404Not Found

Response Parameters:

Parameter NameDescriptionTypeSchema
codeinteger(int32)integer(int32)
datainteger(int64)integer(int64)
extMsgstring
msgstring

Response Example:

javascript
{
	"code": 0,
	"data": 0,
	"extMsg": "",
	"msg": ""
}