|
@@ -135,7 +135,12 @@ func (t *TempAlarmNode) newAlarmMessage(message *protocol.Message) error {
|
|
|
func (t *TempAlarmNode) evaluateConditions(message *protocol.Message) bool {
|
|
|
deviceId := message.MetaData["device_id"].(string)
|
|
|
// 判断设备类型
|
|
|
- if message.MetaData["product_key"].(string) != t.config.ProductKey && message.MetaData["product_key"].(string) != mainCode {
|
|
|
+
|
|
|
+ productKey := message.MetaData["product_key"].(string)
|
|
|
+ fmt.Printf("产品key:%s---------------\n", productKey)
|
|
|
+
|
|
|
+ if productKey != t.config.ProductKey && productKey != mainCode {
|
|
|
+ fmt.Printf("产品key匹配不正确返回false----------------\n")
|
|
|
return false
|
|
|
}
|
|
|
|
|
@@ -146,11 +151,13 @@ func (t *TempAlarmNode) evaluateConditions(message *protocol.Message) bool {
|
|
|
onlinereply := rpcs.ReplyGetDeviceOnlineStatus{}
|
|
|
err := server.RPCCallByName(nil, rpcs.DeviceManagerName, "DeviceManager.GetDeviceOnlineStatus", onlineargs, &onlinereply)
|
|
|
if err != nil || onlinereply.ClientIP == "" {
|
|
|
+ fmt.Printf("设备不在线返回false----------------\n")
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
// 判断报警规则
|
|
|
if len(t.config.Rules) == 0 {
|
|
|
+ fmt.Printf("未匹配到报警规则返回false----------------\n")
|
|
|
return false
|
|
|
}
|
|
|
|
|
@@ -163,6 +170,7 @@ func (t *TempAlarmNode) evaluateConditions(message *protocol.Message) bool {
|
|
|
}
|
|
|
// 判断设备是否开机
|
|
|
if data["power"].(float64) == 0 {
|
|
|
+ fmt.Printf("未开机返回false----------------\n")
|
|
|
_ = deleteAlarm(deviceId)
|
|
|
return false
|
|
|
}
|