I am using a node opc ua client to connect to a opc ua server. I have added a subscription for an item on the server like this:
...
addMonitoringFor(opcNode, callback) {
const monitoredItem = opcSession.monitor({
nodeId: opcua.resolveNodeId(opcNode.nodeId),
attributeId: opcua.AttributeIds.Value
}, {
samplingInterval: 100,
discardOldest: true,
queueSize: 10
},
opcua.read_service.TimestampsToReturn.Both
);
monitoredItem.on("changed", dataValue => {
if (dataValue === undefined || dataValue.value === null) {
callback(`The subscription for the Opc Servernode ${opcNode.nodeId.replace(/\./g, " ")} failed.`);
} else {
callback(null, dataValue.value.value);
}
});
}
...
The on change function is only called when the data actually changes but i would like to have the data for a concrete time series.
How can this be achieved?