文档

设备告警开放服务API

更新时间:
一键部署

1. 概述

告警开放服务是应用服务平台告警功能的API版本,除继承原有告警功能外,还扩展支持告警边缘端部署运行,不同类型设备联合告警,时间窗口延迟触发告警等功能。

2. 接口定义

2.1 新增或更新告警规则

路径

/alarm/rule/addorupdate

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

alarmName

String

必填

告警规则名称

alarmLevel

Integer

必填

告警等级,0严重,1高,2中,3低

auxiliaryLevel

Integer

非必填

辅助等级,0~999,客户自定义

alarmContent

String

必填

告警内容

productKey

String

必填

设备PK

sceneConfig

String

必填

阈值告警规则配置(限值告警高限值配置)

详细参考附录

extConfig

字符串

非必填

扩展内容,用于回填

receivers

JSONArray

非必填

告警消息接收者

alarmType

Integer

必填

告警类型,1运行告警,2故障告警

alarmMode

Integer

必填

告警模式,1阈值告警,2限值告警

timeWindow

Integer

非必填

时间窗口,告警满足条件持续一段时间后触发,单位:秒

runEnv

String

必填

运行环境,cloud云端,edge边缘端

multiDevice

Integer

是否多设备

alarmRuleId

String

非必填

告警规则ID,更新时必填

lowSceneConfig

String

非必填

限值告警的低限值规则配置,限制告警必填

详细参考附录

告警消息接收者receivers:

名称

类型

是否必选

描述

type

String

必填

接收类型,EMAIL邮箱,receivers不为空时必填

email

String

必填

邮箱地址,receivers不为空时必填

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

data

String

新增或更新的告警记录ID

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 设置参数
request.putParam("alarmName","value1");
request.putParam("alarmLevel","value2");
request.putParam("auxiliaryLevel","value3");
request.putParam("alarmContent","value4");
request.putParam("productKey","value5");
request.putParam("sceneConfig","value6");
request.putParam("extConfig","value7");
request.putParam("receivers","value8");
request.putParam("alarmType","value9");
request.putParam("alarmMode","value10");
request.putParam("timeWindow","value11");
request.putParam("runEnv","value12");
request.putParam("multiDevice","value13");
request.putParam("alarmRuleId","value14");
request.putParam("lowSceneConfig","value15");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/alarm/rule/addorupdate", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

请求入参示例:

{
   "alarmName": "新增告警规则",
   "alarmLevel": 0,
   "auxiliaryLevel": 10,
   "alarmContent": "设备产生告警",
   "productKey": "a1gEQeIkPn5",
   "sceneConfig": "{/* 见附录1 */}",
   "receivers": [
       {
            "type": "EMAIL",
            "email": "test@163.com"
       }
   ],
   "alarmType": 1,
   "alarmMode": 1,
   "timeWindow": 300,
   "runEnv": "cloud",
   "multiDevice": 0
}

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null,
    "data": ""
}

异常返回示例:

{
    "id": "37f7e5fa-d6a5-4efe-8abf-5bf23dca6284",
     "code": 28403,
     "message": "The project not exist",
     "localizedMsg": "该项目不存在",
     "data": null
}

2.2 批量删除告警规则

路径

/alarm/rule/delete

版本号

1.0.1

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

alarmRuleIds

JSONArray<String>

必填

告警规则ID的集合

clusterId

String

非必填

集群ID,告警运行在边缘端时必填

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

data

JSON array<String>

删除失败的规则ID列表

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.1");
// 设置参数
request.putParam("alarmRuleIds","value1");
request.putParam("clusterId","value2");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/alarm/rule/delete", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

请求入参示例:

{
   ["8e2e8d41f4604878b413fc588333f068", "df152383d40842b0814346cc88cfd1b4"],
   "pVxFeNmZ8axogEnWCD9E"
}

正常返回示例:

{
   "code": 200,
   "message": "success",
   "data": ["df152383d40842b0814346cc88cfd1b4"]
}

异常返回示例:

{
   "code": 28420,
   "message": "No access to alarm rule",
   "localizedMsg": "无权访问该告警规则"
}

2.3 分页查询告警规则列表

路径

/alarm/rule/query

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

nameLike

String

非必填

告警规则名称,模糊匹配

alarmLevel

Integer

非必填

告警等级,0严重,1高,2中,3低

status

Integer

非必填

启用状态,1启用,0停止

alarmType

Integer

非必填

告警类型,1运行告警,2故障告警

alarmMode

Integer

非必填

告警模式,1阈值告警,2限值告警

runEnv

String

非必填

运行环境,cloud云端,edge边缘端

pageNo

Integer

必填

当前页码,默认1

pageSize

Integer

必填

每页条数,默认20

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

data

JSON array

响应结果

响应结果 data:

名称

类型

描述

total

Integer

总条数

pageNo

Integer

当前页码

pageSize

Integer

每页条数

data

Integer

告警规则列表

告警规则列表 data:

名称

类型

描述

alarmRuleId

String

告警规则ID

alarmName

String

告警规则名称

status

Integer

启用状态,1启用,0停止

alarmLevel

Integer

告警等级,0严重,1高,2中,3低

auxiliaryLevel

Integer

辅助等级,0~999,用户自定义

content

String

告警内容

productKey

String

设备PK

alarmType

Integer

告警类型,1运行告警,2故障告警

runEnv

String

运行环境,cloud云端,edge边缘端

multiDevice

Integer

是否多设备,0单设备,1多设备

alarmMode

Integer

告警模式,1阈值告警,2限值告警

timeWindow

Integer

时间窗口,告警满足条件持续一段时间后触发,单位:秒

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 设置参数
request.putParam("nameLike","value1");
request.putParam("alarmLevel","value2");
request.putParam("status","value3");
request.putParam("alarmType","value4");
request.putParam("alarmMode","value5");
request.putParam("runEnv","value6");
request.putParam("pageNo","value7");
request.putParam("pageSize","value8");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/alarm/rule/query", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

请求入参示例:

{
   "nameLike": "告警",
   "alarmLevel": 0,
   "alarmType": 1,
   "status": 1,
   "alarmMode": "2",
   "runEnv": "edge",
   "pageNo": 1,
   "pageSize": 10
}

正常返回示例:

{
   "code": 200,
   "message": "success",
   "data": {
       "total": 100,
       "pageNo": 1,
       "pageSize": 10,
       "data": [
            {
                "alarmRuleId": "df152383d40842b0814346cc88cfd1b4",
                "alarmName": "设备告警",
                "status": 1,
                "alarmLevel": 0,
                "auxiliaryLevel": 5,
                "content": "设备电压超标",
                "productKey": "a1gEQeIkPn5",
                "alarmType": 1,
                "runEnv": "edge",
                "multiDevice": 0,
                "alarmMode": 2,
                "timeWindow": 600
            }
       ]
   }
}

异常返回示例:

{
   "code": 28403,
   "message": "The project not exist",
   "localizedMsg": "该项目不存在"
}

2.4 查询单个告警规则的详情

路径

/alarm/rule/detail/get

版本号

1.0.0

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

alarmRuleId

String

必填

告警规则ID

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

data

JSON

响应结果

响应结果 data:

名称

类型

描述

alarmRuleId

String

告警规则ID

alarmName

String

告警规则名称

status

Integer

启用状态,1启用,0停止

sceneConfig

阈值告警规则配置(限值告警高限值配置)

extConfig

String

扩展配置

alarmLevel

Integer

告警等级,0严重,1高,2中,3低

auxiliaryLevel

Integer

辅助等级,0~999,用户自定义

content

String

告警内容

productKey

String

设备PK

receivers

List

告警消息接收者

alarmType

Integer

告警类型,1运行告警,2故障告警

lowSceneConfig

String

限值告警的低限值规则配置

runEnv

String

运行环境,cloud云端,edge边缘端

multiDevice

Integer

是否多设备,0单设备,1多设备

alarmMode

Integer

告警模式,1阈值告警,2限值告警

timeWindow

Integer

时间窗口,告警满足条件持续一段时间后触发,单位:秒

告警消息接收者receivers

名称

类型

描述

type

String

接收类型,EMAIL邮箱

email

String

邮箱地址

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 设置参数
request.putParam("alarmRuleId","value1");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/alarm/rule/detail/get", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

请求入参示例:

"alarmRuleId": "df152383d40842b0814346cc88cfd1b4"

正常返回示例:

{
   "code": 200,
   "message": "success",
   "data": {
       "alarmRuleId": "df152383d40842b0814346cc88cfd1b4",
       "alarmName": "设备告警",
       "status": 1,
       "alarmLevel": 0,
       "auxiliaryLevel": 5,
       "content": "设备电压超标",
       "productKey": "a1gEQeIkPn5",
       "sceneConfig": "{}",
       "receivers": [
            {
                "type": "EMAIL",
                "email": "test@163.com"
            }
       ],
       "alarmType": 1,
       "lowSceneConfig": "{}",
       "runEnv": "edge",
       "multiDevice": 0,
       "alarmMode": 2,
       "timeWindow": 600
   }
}

异常返回示例:

{
   "code": 28403,
   "message": "The project not exist",
   "localizedMsg": "该项目不存在"
}

2.5 批量操作告警规则启停

路径

/alarm/rule/status/update

版本号

1.0.2

协议

HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

alarmRuleIds

JSONArray<String>

必填

告警规则ID

operType

Integer

必填

操作类型,1启动,0停止

clusterId

String

非必填

集群ID,告警运行在边缘端时必填

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

data

JSON

响应结果

响应结果 data:

名称

类型

描述

deployId

字符串

部署单ID

failAlarmIds

JSONArray<String>

失败告警ID列表

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.2");
// 设置参数
request.putParam("alarmRuleIds","value1");
request.putParam("operType","value2");
request.putParam("clusterId","value3");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/alarm/rule/status/update", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

请求入参示例:

{
   ["8e2e8d41f4604878b413fc588333f068", "df152383d40842b0814346cc88cfd1b4"],
   "operType": 0,
   "pVxFeNmZ8axogEnWCD9E"
}

正常返回示例:

{
   "code": 200,
   "message": "success",
   "data": ["df152383d40842b0814346cc88cfd1b4"]
}

异常返回示例:

{
   "code": 28420,
   "message": "No access to alarm rule",
   "localizedMsg": "无权访问该告警规则"
}

2.6 批量更新告警记录确认状态

路径

/alarm/record/confirm

版本号

1.0.0

协议

HTTP, HTTPS

请求方法

POST

授权类型

app签名

超时时间

10000

请求参数

名称

类型

是否必选

描述

alarmRecordIds

JSONArray<Long>

必填

告警记录ID

confirm

Integer

必填

确认状态,0未确认,1已确认

返回数据

名称

类型

描述

code

Int

接口返回码。200表示成功。

message

String

调用失败时,返回的出错信息。

localizedMsg

String

本地语言的错误消息。

data

BOOL

响应结果:True or False

示例

请求示例:

// https://github.com/aliyun/iotx-api-gateway-client
IoTApiClientBuilderParams ioTApiClientBuilderParams = new IoTApiClientBuilderParams();

ioTApiClientBuilderParams.setAppKey("你的<AppKey>");
ioTApiClientBuilderParams.setAppSecret("你的<AppSecret>");

SyncApiClient syncApiClient = new SyncApiClient(ioTApiClientBuilderParams);

IoTApiRequest request = new IoTApiRequest();

// 设置请求ID
String uuid = UUID.randomUUID().toString();
String id = uuid.replace("-", "");
request.setId(id);
// 设置API版本号
request.setApiVer("1.0.0");
// 设置参数
request.putParam("alarmRecordIds","value1");
request.putParam("confirm","value2");
// 如果需要,设置headers
Map<String, String> headers = new HashMap<String, String>(8);
// headers.put("你的<header", "你的<value>");

// 设置请求参数域名、path、request , isHttps, headers
ApiResponse response = syncApiClient.postBody("api.link.aliyun.com", "/alarm/record/confirm", request, true, headers);

System.out.println(
    "response code = " + response.getCode()
        + " response = " + new String(response.getBody(), "UTF-8")
        + " headers = " + response.getHeaders().toString()
);

请求入参示例:

{
   "alarmRecordIds": [1000000001, 1000000002],
   "confirm": 1
}

正常返回示例:

{
    "id": "4de2c367-c1db-417c-aa15-8c585e595d92",
    "code": 200,
    "message": null,
    "localizedMsg": null,
    "data": true
}

异常返回示例:

{
   "code": 28403,
   "message": "The project not exist",
   "localizedMsg": "该项目不存在"
}

3. 数据模型定义

接入方式

数据模型

模型ID

AlarmRecord

模型版本号

1.1

模型描述

告警规则产生的记录

属性列表

参数

是否必选

类型

描述

alarmName

非必选

String

告警规则名称

deviceName

非必选

String

设备deviceName

productKey

非必选

String

设备productKey

productName

非必选

String

产品名称

alarmLevel

非必选

Integer

告警等级,0严重,1高,2中,3低

auxiliaryLevel

非必选

Integer

辅助等级,客户自定义

recovery

非必选

Integer

是否恢复,0未恢复,1已恢复

confirm

非必选

Integer

是否确认,0未确认,1已确认

recoveryTime

非必选

Date

恢复时间,毫秒级时间戳

confirmTime

非必选

Date

确认时间,毫秒级时间戳

alarmContent

非必选

String

告警内容描述

alarmType

非必选

Integer

告警类型,1运行告警,2故障告警

alarmMode

非必选

Integer

告警模式,1阈值告警,2限值告警

restrictAlarmType

非必选

Integer

限值告警类型,1高限值告警,2低限值告警

extConfig

非必选

String

扩展配置,用于回填

time

非必选

Date

告警产生时间,毫秒级时间戳

operator

非必选

String

操作人员

sceneId

非必选

String

场景ID

alarmId

非必选

String

告警记录ID

confirmType

非必选

Integer

确认类型。1故障,2误报,3报警

confirmComment

非必选

String

确认告警的备注信息

4. 附录

sceneConfig和lowSceneConfig格式样例

1. 水位从<=80%变化到>80%告警,从>80%变化到<=80%取消告警

{

"type": "IFTTT",

"trigger": {

"uri": "trigger/device/property",

"params": {

"productKey": "MyProduct",

"deviceName": "MyDevice",

"propertyName": "level",

"compareType": ">",

"compareValue": 80

}

},

"action": [

{

"uri": "action/mqtt/pub/sceneInfo",

"params": {

"env": "edge"

}

}

],

"features": {

"supportPauseRule": {

"pauseType": "time",

"pauseParams": {},

"scope": "device",

"recoverCondition": "event.level.value <= 80", // Must be the opposite of the condition in trigger.

"notifyTypeOnRecover": "MQTT",

"notifyTopicOnRecover": "Ignored"

}

}

}

2.温度>80度持续15分钟告警,温度<=80度取消告警

{

"type": "IFTTT",

"trigger": {

"uri": "trigger/device/property",

"params": {

"productKey": "MyProduct",

"deviceName": "MyDevice",

"propertyName": "temp",

"compareType": ">",

"compareValue": 80

}

},

"action": [

{

"uri": "action/mqtt/pub/sceneInfo",

"params": {

"env": "edge"

}

}

],

"features": {

"supportPauseRule": {

"pauseType": "time",

"pauseParams": {

"stateDuration": 900, //the continuous time of a state, 1s <= time <= 3600s

},

"scope": "device",

"recoverCondition": "event.temp.value <= 80", // Must be the opposite of the condition in trigger.

"notifyTypeOnRecover": "MQTT",

"notifyTopicOnRecover": "Ignored"

}

}

}

3.水位从<=20cm变化到>20cm告警,从>20cm变化到<=20cm取消告警

{

"type": "IFTTT",

"trigger": {

"uri": "trigger/device/property",

"params": {

"productKey": "MyProduct",

"deviceName": "MyDevice",

"propertyName": "level",

"compareType": ">",

"compareValue": 20

}

},

"action": [

{

"uri": "action/mqtt/pub/sceneInfo",

"params": {

"env": "edge"

}

}

],

"features": {

"supportPauseRule": {

"pauseType": "time",

"pauseParams": {},

"scope": "device",

"recoverCondition": "event.level.value <= 20", // Must be the opposite of the condition in trigger.

"notifyTypeOnRecover": "MQTT",

"notifyTopicOnRecover": "Ignored"

}

}

}

4.消防点位状态从非动作信号变化为动作信号告警,从动作信号变为非动作信号取消告警

{

"type": "IFTTT",

"trigger": {

"uri": "trigger/device/property",

"params": {

"productKey": "MyProduct",

"deviceName": "MyDevice",

"propertyName": "state",

"compareType": ">",

"compareValue": 1 // 1 for action signal, others for non action signal.

}

},

"action": [

{

"uri": "action/mqtt/pub/sceneInfo",

"params": {

"env": "edge"

}

}

],

"features": {

"supportPauseRule": {

"pauseType": "time",

"pauseParams": {},

"scope": "device",

"recoverCondition": "event.level.value != 1", // Must be the opposite of the condition in trigger.

"notifyTypeOnRecover": "MQTT",

"notifyTopicOnRecover": "Ignored"

}

}

}

5.管网压力持续5分钟在[0.9, 1.2]之外告警,管网压力在[0.9, 1.2]之内取消告警

{

"type": "IFTTT",

"trigger": {

"uri": "trigger/device/property",

"params": {

"productKey": "MyProduct",

"deviceName": "MyDevice",

"propertyName": "pressure",

"compareType": "beyond",

"compareValue": [0.9, 1.2]

}

},

"action": [

{

"uri": "action/mqtt/pub/sceneInfo",

"params": {

"env": "edge"

}

}

],

"features": {

"supportPauseRule": {

"pauseType": "time",

"pauseParams": {

"stateDuration": 300, //the continuous time of a state, 1s <= time <= 3600s

},

"scope": "device",

"recoverCondition": "event.pressure.value >= 0.9 and event.pressure.value <= 1.2", // Must be the opposite of the condition in trigger.

"notifyTypeOnRecover": "MQTT",

"notifyTopicOnRecover": "Ignored"

}

}

}

6.水浸点>80连续5次告警,水浸点<=80度取消告警

{

"type": "IFTTT",

"trigger": {

"uri": "trigger/device/property",

"params": {

"productKey": "MyProduct",

"deviceName": "MyDevice",

"propertyName": "level",

"compareType": ">",

"compareValue": 80

}

},

"action": [

{

"uri": "action/mqtt/pub/sceneInfo",

"params": {

"env": "edge"

}

}

],

"features": {

"supportPauseRule": {

"pauseType": "count",

"pauseParams": {

"windowInterval": 60, // Set to maximum window interval. This is the minimum sensitivity.

"conditionMatchNum": 5,

"continuousMatch": true,

"executeOnce": true

},

"scope": "device",

"recoverCondition": "event.temp.value <= 80", // Must be the opposite of the condition in trigger.

"notifyTypeOnRecover": "MQTT",

"notifyTopicOnRecover": "Ignored"

}

}

}

7.夜间10点至次日早6点,门禁触发开门则告警

{

"type": "IFTTT",

"trigger": {

"uri": "trigger/device/property",

"params": {

"productKey": "MyProduct",

"deviceName": "MyDevice",

"propertyName": "door",

"compareType": "==",

"compareValue": 1

}

},

"condition": {

"uri": "condition/timeRange",

"params": {

"beginDate": "22:00:00",

"endDate": "06:00:00",

"format": "HH:mm:ss",

"timezoneID": "Asia/Shanghai"

}

},

"action": [

{

"uri": "action/mqtt/pub/sceneInfo,

"params": {

"env": "edge"

}

}

],

"features": {

"supportPauseRule": {

"pauseType": "time",

"pauseParams": {},

"scope": "device",

"recoverCondition": "event.door.value != 1", // Must be the opposite of the condition in trigger.

"notifyTypeOnRecover": "MQTT",

"notifyTopicOnRecover": "Ignored"

}

}

}

8.1分钟内温度>30度连续10次告警,温度<=30度取消告警

{

"type": "IFTTT",

"trigger": {

"uri": "trigger/device/property",

"params": {

"productKey": "MyProduct",

"deviceName": "MyDevice",

"propertyName": "temp",

"compareType": ">",

"compareValue": 30

}

},

"action": [

{

"uri": "action/mqtt/pub/sceneInfo",

"params": {

"env": "edge"

}

}

],

"features": {

"supportPauseRule": {

"pauseType": "count",

"pauseParams": {

"windowInterval": 1,

"conditionMatchNum": 10,

"continuousMatch": true,

"executeOnce": true

},

"scope": "device",

"recoverCondition": "event.temp.value <= 30", // Must be the opposite of the condition in trigger.

"notifyTypeOnRecover": "MQTT",

"notifyTopicOnRecover": "Ignored"

}

}

}

9.设备下线告警,设备上线恢复告警

{

"type": "IFTTT",

"trigger": {

"uri": "trigger/device/statusChange",

"params": {

"productKey": "MyProduct",

"deviceName": "MyDevice",

"status": 3

}

},

"action": [

{

"uri": "action/mqtt/pub/sceneInfo",

"params": {

"env": "edge"

}

}

],

"features": {

"supportPauseRule": {

"pauseType": "time",

"pauseParams": {},

"scope": "device",

"recoverCondition": "event.status.value != 3", // Must be the opposite of the condition in trigger.

"notifyTypeOnRecover": "MQTT",

"notifyTopicOnRecover": "Ignored"

}

}

}