liuxiulin 1 day ago
parent
commit
842002f3cd
1 changed files with 5 additions and 5 deletions
  1. 5 5
      pkg/ruleEngine/nodes/temp_alarm_node.go

+ 5 - 5
pkg/ruleEngine/nodes/temp_alarm_node.go

@@ -180,11 +180,11 @@ func (t *TempAlarmNode) evaluateConditions(message *protocol.Message) bool {
 		} else {
 			for _, r := range results {
 				if r {
-					break
+					return true
 				}
-				_ = deleteAlarm(deviceId)
-				return false
 			}
+			_ = deleteAlarm(deviceId)
+			return false
 		}
 	}
 
@@ -215,9 +215,9 @@ func (t *TempAlarmNode) evaluateConditions(message *protocol.Message) bool {
 	}
 
 	duration := time.Now().Sub(time.Unix(reply.AlarmParams.FirstReportTime, 0))
-	if duration.Seconds() > float64(t.config.Interval*60) {
+	if duration.Seconds() > float64(t.config.Duration*60) {
 		interval := time.Now().Sub(time.Unix(reply.AlarmParams.LastAlarmTime, 0))
-		if interval.Seconds() >= float64(t.config.Duration*60) {
+		if interval.Seconds() >= float64(t.config.Interval*60) {
 			setArgs := rpcs.ArgsAlarmInfo{
 				DeviceCode:      deviceId,
 				FirstReportTime: reply.AlarmParams.FirstReportTime,