add dbm new model and fixed json_data

This commit is contained in:
Adrian Zürcher
2025-05-12 17:12:25 +02:00
parent 5ee97416dd
commit 836a69f914
14 changed files with 260 additions and 167 deletions

View File

@@ -18,7 +18,7 @@ func (d *DBMHandler) Subscribe(req *json_dataModels.Request, id string) {
resp.Id = req.Id
for _, sub := range req.Subscribe {
for _, dp := range d.DB.QueryDatapoints(sub.Depth, sub.Path) {
for _, dp := range d.DBM.QueryDatapoints(sub.Depth, sub.Uuid, sub.Path) {
if sub.Driver != "" {
if dp.Drivers == nil || dp.Drivers[sub.Driver] == nil {
continue
@@ -51,9 +51,10 @@ func (d *DBMHandler) Unsubscribe(req *json_dataModels.Request, id string) {
defer d.RUnlock()
resp := json_dataModels.NewResponse()
resp.Id = req.Id
for _, sub := range req.Unsubscribe {
for _, dp := range d.DB.QueryDatapoints(sub.Depth, sub.Path) {
for _, dp := range d.DBM.QueryDatapoints(sub.Depth, sub.Uuid, sub.Path) {
if _, ok := dp.Subscriptions[id]; !ok {
continue
}
@@ -64,7 +65,6 @@ func (d *DBMHandler) Unsubscribe(req *json_dataModels.Request, id string) {
})
}
}
if err := d.Conns.SendResponse(id, resp); err != nil {
d.Log.Error("subscribe.Unsubscribe", err.Error())
}