Browse Source

新增告警计划参数

nifangxu 1 month ago
parent
commit
7754e7143d
2 changed files with 6 additions and 3 deletions
  1. 3 1
      core/alarm_plan.py
  2. 3 2
      core/alarm_plan_manager.py

+ 3 - 1
core/alarm_plan.py

@@ -163,7 +163,8 @@ class AlarmPlan:
                  rect: list,
                  event_type: int,
                  threshold_time: int,
-                 merge_time: int
+                 merge_time: int,
+                 param: dict
                  ):
         self.lock_          = Lock()
         self.plan_uuid_     = plan_uuid     # 计划id
@@ -171,6 +172,7 @@ class AlarmPlan:
         self.dev_id_        = dev_id        # 设备id
         self.enable_        = enable        # 是否启用
         self.time_plan_     = time_plan     # 时间计划
+        self.param_         = param         # 参数
 
         # 维护状态(根据TimePlanu判断)
         self.status_ = 0     # 0未激活,1激活,-1过期

+ 3 - 2
core/alarm_plan_manager.py

@@ -177,6 +177,7 @@ def cb_handle_query_all_alarm_plan_info(result):
                 rect: list      = json.loads(row["region"])
                 threshold_time: int = row["threshold_time"]
                 merge_time: int     = row["merge_time"]
+                param: dict     = json.loads(row["param"])
 
                 event_val: int   = row["event_val"]
                 event_type      = event_val
@@ -211,13 +212,13 @@ def cb_handle_query_all_alarm_plan_info(result):
                     rect        = rect,
                     event_type  = event_type,
                     threshold_time  = threshold_time,
-                    merge_time  = merge_time
+                    merge_time  = merge_time,
+                    param       = param
                 )
                 if alarm_plan.event_attr_ is None:
                     LOGERR(f"drop plan {plan_uuid}, invalid event_type: {event_type}")
                     continue
 
-
                 # 更新设备信息
                 g_las.g_alarm_plan_mgr.push(plan_uuid, alarm_plan)