Skip to content

Compare

Threshold-based change detection.

1 modules

ModuleDescription
檢測變動檢測數值是否超過門檻變動(依數量或百分比)

Modules

檢測變動

compare.change

檢測數值是否超過門檻變動(依數量或百分比)

Parameters:

NameTypeRequiredDefaultDescription
current_valuenumberYes-The current/new value to compare
previous_valuenumberYes-The previous/old value to compare against
modeselect (percent, absolute, any)Nopercent要比較的先前/舊數值
thresholdnumberNo5觸發的最小變動(5 = 5% 或 5 單位)
directionselect (both, up, down)Noboth要檢測的變動方向

Output:

FieldTypeDescription
okboolean操作是否成功
changedboolean操作是否成功
directionstring操作是否成功
change_percentnumber變動方向:
change_absolutenumber百分比變動(正值 = 上升,負值 = 下降)
current_valuenumberThe current value
previous_valuenumberThe previous value
summarystring目前數值

Example: Crypto price alert (5% change)

yaml
current_value: 44500
previous_value: 42000
mode: percent
threshold: 5
direction: both

Example: Stock drop alert

yaml
current_value: 145.5
previous_value: 152.3
mode: percent
threshold: 3
direction: down

Example: Temperature change (absolute)

yaml
current_value: 32
previous_value: 25
mode: absolute
threshold: 5
direction: up

Released under the Apache 2.0 License.