Skip to content

创建自动化

接口地址:/v2/cep/enduserapi/automation/save

请求方式:POST

请求数据类型:application/json

响应数据类型:*/*

接口描述:

创建自动化

请求示例:

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": ""
  }
}

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
cmdcmdbodytrue自动化信息请求自动化信息请求
  actions执行动作truearray自动化执行动作
    delayTime延迟时间,单位秒falseinteger
    deviceKey设备DK/群组IDfalsestring
    icon设备/群组/场景图标falsestring
    idfalseinteger
    name设备/群组/场景名称falsestring
    productKey产品PK/群组PKfalsestring
    property设备属性false物模型属性物模型属性
      code物模型标识符truestring
      compare比较符。>>=<<===
      dataType数据类型。支持:BOOL、ENUM、INT、FLOAT、DOUBLE,可用值:BOOL,DOUBLE,ENUM,FLOAT,INTtruestring
      id物模型功能IDtrueinteger
      name物模型名称truestring
      subNamefalsestring
      subTypefalsestring
      type物模型类型falsestring
      unit物模型单位falsestring
      value物模型属性比较值falseobject
    sceneId场景IDfalsestring
    sort执行动作顺序,从1开始递增trueinteger
    type执行动作类型。1:延时,2:设备,3:群组,4:场景trueinteger
  automationId自动化IDfalseinteger(int64)
  conditionType触发类型。1: 满足任意,2: 满足所有trueinteger(int32)
  conditions触发条件truearray自动化触发条件
    deviceKey设备DKfalsestring
    icon设备/群组/场景图标falsestring
    name设备/群组/场景名称falsestring
    productKey产品PKfalsestring
    property设备属性false物模型属性物模型属性
      code物模型标识符truestring
      compare比较符。>>=<<===
      dataType数据类型。支持:BOOL、ENUM、INT、FLOAT、DOUBLE,可用值:BOOL,DOUBLE,ENUM,FLOAT,INTtruestring
      id物模型功能IDtrueinteger
      name物模型名称truestring
      subNamefalsestring
      subTypefalsestring
      type物模型类型falsestring
      unit物模型单位falsestring
      value物模型属性比较值falseobject
    sort条件顺序,从1开始递增trueinteger
    timer条件时间false自动化触发条件时间自动化触发条件时间
      dayOfWeek重复周期。定时类型为自定义时必填,1,2,3...7表示周一到周日falsestring
      time定时执行时间点。符合HH:mm格式truestring
      timeZone时区,格式:+-HH:mmtruestring
      type定时类型。0:仅一次,1:每天,2:自定义trueinteger
    type触发条件类型。0:设备,1:定时trueinteger
  fid家庭ID,开启家居模式必填,否则不填falsestring
  name自动化名称truestring
  nameType自动化名称生成方式,1:系统生成,2:用户填写trueinteger(int32)
  precondition生效时间false自动化生效时间自动化生效时间
    effectDate生效日期。生效日期类型为每天时不填。每周:1,2,3,...7表示周一到周日,周月:1-31号,指定日期:符合MM-dd/MM-dd格式,例:12-19/12-21falsestring
    effectDateType生效日期类型。0:每天,1:每周,2:每月,3:指定日期trueinteger
    effectTimeType生效时间类型。0:白天,1:夜晚,2:全天,3:指定时间段trueinteger
    endTime结束时间。生效时间类型为全天和指定时间段时必填,符合HH:mm格式falsestring
    location经纬度。经度在前纬度在后,生效时间类型为白天或夜晚时必填falsestring
    regionName地区名称falsestring
    startTime开始时间。生效时间类型为全天和指定时间段时必填,符合HH:mm格式falsestring
    timeZone时区,格式:+-HH:mmfalsestring
Authorizationheaderfalsestring

响应状态:

状态码说明schema
200OKApiResult«long»
201Created
401Unauthorized
403Forbidden
404Not Found

响应参数:

参数名称参数说明类型schema
codeinteger(int32)integer(int32)
datainteger(int64)integer(int64)
extMsgstring
msgstring

响应示例:

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