SmartAlarmAbility.addCustomAlarm(options: AddCustomAlarmOptions)
Requires:
@ray-js/panel-sdk≥1.8.0
Description
Create or edit a custom alert rule
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| Yes | Alert rule configuration |
Return Value
Type: Promise<AddCustomAlarmResult>
Tuple [the created/updated rule, the updated full rule list]
Referenced Types
type
AddCustomAlarmResulttype
DpIdtype
AddCustomAlarmBindResult| Property | Type | Description |
|---|---|---|
associativeEntityValue | string | Associated entity value, used to distinguish alarm types |
associativeEntityId | string | Associated entity ID, typically the DP ID |
bindId | number | Binding ID |
bizDomain | string | Business domain, fixed as miniAppPanelSDKAlarm for alarms |
enable | boolean | Whether enabled |
sourceEntityId | string | Device ID |
type
CustomAlarmListtype
CustomAlarmRule| Property | Type | Description |
|---|---|---|
triggerRuleId | string | ID of the rule executed by the alarm |
| Details of the rule that triggers the alarm; see AlarmTriggerRuleVO | ||
bizDomain | string | Business domain identifier, fixed as miniAppPanelSDKAlarm in the alarm SDK |
associativeEntityValue | string | Used when associativeEntityId is not sufficient to distinguish cases—for example, when the same DP is used but alarm types must be differentiated. You can use DpValue; generally not required. |
sourceEntityId | string | Device ID associated with the current alarm |
name | string | Name or note |
icon | string | Icon |
bindId | number | Binding ID |
associativeEntityId | string | DP ID associated with the current alarm |
enable | boolean | Whether enabled |
type
AlarmTriggerRuleVO| Property | Type | Description |
|---|---|---|
ownerId | string | Home ID |
enabled | boolean | Whether the alarm rule is enabled |
id | string | Execution rule ID |
name | string | Alarm name or note |
| Preconditions for executing actions; see AlarmPreCondition | ||
| Conditions for executing actions; see CustomAlarmCondition | ||
| Actions to execute; see CustomAlarmSceneAction |
type
AlarmPreCondition| Property | Type | Description |
|---|---|---|
| Condition expression | ||
condType | "timeCheck" | Condition type, fixed as timeCheck in the alarm SDK |
id | string | Condition ID |
type
CustomAlarmCondition| Property | Type | Description |
|---|---|---|
id | string | Condition ID |
ruleId | string | Rule ID |
entityId | string | Data ID |
entitySubIds | string | Abstract sub-data ID |
expr | string | Condition expression |
type
CustomAlarmSceneAction| Property | Type | Description |
|---|---|---|
id | string | Condition ID |
ruleId | string | Scene ID |
actionExecutor | string | Action type, fixed as appPushTrigger in the alarm SDK |
type
CustomAlarmPreConditionExpr| Property | Type | Description |
|---|---|---|
timeZoneId | string | Time zone ID, e.g., Asia/Shanghai |
start | string | Start time in HH:mm, e.g., 00:00 |
timeInterval | string | Time interval, fixed as 'custom' |
loops | string | Repeat days; '1111111' means all seven days are on, starting from Sunday |
end | string | End time in HH:mm, e.g., 23:59 |
Valid Values
AddCustomAlarmOptions.condition
| Value | Description | Since |
|---|---|---|
== | - | - |
< | - | - |
> | - | - |
<= | - | - |
>= | - | - |