fixed sending empty timeseries update

This commit is contained in:
dashevchenko 2025-03-24 18:14:49 +02:00
parent 31229007a3
commit 70a9679bc8

View File

@ -725,7 +725,11 @@ public class DefaultTbEntityDataSubscriptionService implements TbEntityDataSubsc
update = new EntityDataUpdate(ctx.getCmdId(), ctx.getData(), null, ctx.getMaxEntitiesPerDataSubscription()); update = new EntityDataUpdate(ctx.getCmdId(), ctx.getData(), null, ctx.getMaxEntitiesPerDataSubscription());
ctx.setInitialDataSent(true); ctx.setInitialDataSent(true);
} else { } else {
update = new EntityDataUpdate(ctx.getCmdId(), null, ctx.getData().getData(), ctx.getMaxEntitiesPerDataSubscription()); // to avoid updating timeseries with empty values
List<EntityData> data = ctx.getData().getData().stream()
.peek(entityData -> entityData.setTimeseries(null))
.toList();
update = new EntityDataUpdate(ctx.getCmdId(), null, data, ctx.getMaxEntitiesPerDataSubscription());
} }
ctx.sendWsMsg(update); ctx.sendWsMsg(update);
} finally { } finally {