[feat]网关子设备,直接上传,自动创建设备模型,无需手动创建

This commit is contained in:
PandaX
2023-10-17 11:14:18 +08:00
parent f26c5a2647
commit 55e399e5cb
23 changed files with 1457 additions and 74 deletions

View File

@@ -3,7 +3,6 @@ package nodes
import (
"encoding/json"
"github.com/sirupsen/logrus"
"log"
"pandax/apps/device/services"
"pandax/pkg/global"
"pandax/pkg/rule_engine/message"
@@ -36,7 +35,6 @@ func (n *clearAlarmNode) Handle(msg *message.Message) error {
alarm := services.DeviceAlarmModelDao.FindOneByType(msg.Metadata.GetValue("deviceId").(string), n.AlarmType, "0")
if alarm.DeviceId != "" {
log.Println("清除告警")
alarm.State = global.CLEARED
marshal, _ := json.Marshal(msg.Msg)
alarm.Details = string(marshal)

View File

@@ -3,7 +3,6 @@ package nodes
import (
"errors"
"github.com/sirupsen/logrus"
"log"
"pandax/pkg/rule_engine/manifest"
"pandax/pkg/rule_engine/message"
)
@@ -71,7 +70,6 @@ func GetNodes(m *manifest.Manifest) (map[string]Node, error) {
metadata := NewMetadataWithValues(n.Properties)
node, err := NewNode(n.Type, n.Id, metadata)
if err != nil {
log.Println(err)
logrus.Errorf("new node '%s' failure", n.Id)
continue
}