getCustomAlarmList
描述
查询自定义创建的告警规则列表。
类型
interface LinkageRule {
triggerRuleId: string;
triggerRuleVO: TriggerRuleVO;
bizDomain: string;
associativeEntityValue?: string;
sourceEntityId: string;
name?: string;
icon?: string;
bindId: number;
associativeEntityId?: string;
}
export declare class SmartAlarmAbility implements SmartDeviceAbility {
getCustomAlarmList: (options?: {
dpId?: string;
devId?: string;
}) => Promise<LinkageRule[]>;
}
请求参数
参数 | 数据类型 | 说明 | 是否必填 |
---|---|---|---|
options.dpId | string | 要创建告警规则的功能点 id,不填则拉取所有 | 否 |
options.devId | string | 设备 ID,不填则默认自动读取当前环境下的设备 id | 否 |
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。
返回参数
参数 | 数据类型 | 说明 |
---|---|---|
triggerRuleId | string | 告警执行的规则 id |
triggerRuleVO | TriggerRuleVO | 触发告警规则的详细信息,详见 TriggerRuleVO 定义 |
bizDomain | string | 业务域标识,在告警 SDK 下固定为 miniAppPanelSDKAlarm |
associativeEntityValue | string | 当 associativeEntityId 不足以区分情况下使用,比如使用的是同一个功能点时又要区分告警类型的情况下,可以使用 DpValue,一般情况下用不到 |
sourceEntityId | string | 和当前告警相关联的设备 ID |
name | string | 名称或备注 |
icon | string | 图标 |
bindId | number | 绑定 id |
associativeEntityId | string | 和当前告警相关联的功能点 DP ID |
TriggerRuleVO: 触发告警规则的详细信息
参数 | 数据类型 | 说明 |
---|---|---|
ownerId | string | 家庭 id |
enabled | boolean | 告警规则是否启用 |
id | string | 执行规则 id |
name | string | 告警名称或备注 |
preConditions | PreCondition[] | 执行动作的前置条件,详见 PreCondition 定义 |
conditions | Condition[] | 执行动作的条件,详见 Condition 定义 |
actions | SceneAction[] | 执行的动作,详见 SceneAction 定义 |
PreCondition: 执行动作的前置条件
参数 | 数据类型 | 说明 |
---|---|---|
expr.timeZoneId | string | 时区 id,如 Asia/Shanghai |
expr.start | string | 开始时间,格式为 HH:mm,如 00:00 |
expr.timeInterval | string | 时间间隔,固定为 'custom' |
expr.loops | string | 循环日期,'1111111' 说明为一周七天均开启,其中起始时间为周日 |
expr.end | string | 结束时间,格式为 HH:mm,如 23:59 |
condType | 'timeCheck' | 条件类型,告警 SDK 固定为 timeCheck |
id | string | 条件 id |
Condition: 执行动作的条件
参数 | 数据类型 | 说明 |
---|---|---|
id | string | 条件 id |
ruleId | string | 规则 id |
entityId | string | 数据 id |
entitySubIds | string | 抽象的子数据 id |
expr | string | 条件的表达式 |
SceneAction: 执行的动作
参数 | 数据类型 | 说明 |
---|---|---|
id | string | 条件 id |
ruleId | string | 场景 id |
actionExecutor | string | 动作类型,在告警 SDK 下固定为 appPushTrigger |
请求示例
import { SmartAlarmAbility } from '@ray-js/panel-sdk';
const Alarm = new SmartAlarmAbility();
const customAlarmList = await Alarm.getCustomAlarmList();
console.log('=== customAlarmList: ', customAlarmList);
返回示例
️🚫 注意,返回示例仅供参考,其包含字段大于返回参数定义范围,请勿使用除本文返回参数定义以外的返回数据,否则可能会导致程序异常。
[
{
"triggerRuleId": "Ecrx5Bhx4sqvUp9B",
"triggerRuleVO": {
"matchType": 1,
"offGwSync": false,
"outOfWork": 0,
"ownerId": "152952332",
"matchStatus": 0,
"ruleGenre": 2,
"offGwSyncSuccess": false,
"id": "Ecrx5Bhx4sqvUp9B",
"runtimeEnv": "prod",
"newLocalScene": false,
"coverIcon": "",
"commonField": "{}",
"name": "门磁状态",
"containDeviceDelete": false,
"conditions": [
{
"icon": "",
"orderNum": 1,
"serverProperty": "",
"enabled": true,
"uid": "ay15234251194155zQ3F",
"entitySubIds": "1",
"ruleType": 3,
"extra": "",
"expr": [
[
"$dp1",
"==",
true
]
],
"attribute": 0,
"id": "eRJ9GihAaQDL75n9vpOE",
"ruleId": "Ecrx5Bhx4sqvUp9B",
"expression": "[[\"$dp1\",\"==\",true]]",
"entityType": 1,
"entityId": "vdevo169579725602982",
"devDelMark": false,
"handleStrategy": "",
"serviceProvider": "",
"condType": 1,
"status": true
}
],
"actions": [
{
"gmtModified": 1697466697571,
"offGwSync": false,
"actionExecutor": "appPushTrigger",
"orderNum": 1,
"enabled": true,
"uid": "ay15234251194155zQ3F",
"executorProperty": {
"deviceExecuteLog": 1
},
"attribute": 0,
"id": "BVvtnjVZbx5jTcrWSJMp",
"ruleId": "Ecrx5Bhx4sqvUp9B",
"actionStrategy": "repeat",
"devDelMark": false,
"status": true
}
],
"status": true,
"gmtModified": 1697467782751,
"code": "",
"preConditions": [
{
"expr": {
"timeZoneId": "Asia/Shanghai",
"start": "00:00",
"timeInterval": "custom",
"loops": "1111111",
"end": "23:59"
},
"condType": "timeCheck",
"id": "V0ElkQ3Aia3HEWGOEXB1"
}
],
"scenarioRule": false,
"linkageType": 0,
"orderWeight": 1,
"needCleanGidSid": false,
"enabled": false,
"uid": "ay15234251194155zQ3F",
"ruleType": 3,
"isLogicRule": false,
"attribute": 32,
"boundForPanel": false,
"isAlarmIssue": false,
"stickyOnTop": false,
"boundForWiFiPanel": false,
"needValidOutOfWork": false,
"gmtCreate": 1697466697551,
"iotAutoAlarm": false,
"localLinkage": false,
"ruleSource": 0,
"auditStatus": 0,
"displayColor": "",
"forceCloudTrigger": false
},
"icon": "",
"bindExecutor": "",
"bizDomain": "miniAppPanelSDKAlarm",
"associativeEntityValue": "",
"ownerId": "152952332",
"conditionRuleId": "",
"bindId": 2899540,
"uid": "ay15234251194155zQ3F",
"enable": false,
"sourceEntityId": "vdevo169579725602982",
"name": "",
"property": "",
"id": 2899540,
"associativeEntityId": "1",
"status": true
}
]
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。