Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPC-UA gateway timeseries configuration handling error #31

Closed
LilaLipetti opened this issue Nov 8, 2017 · 1 comment
Closed

OPC-UA gateway timeseries configuration handling error #31

LilaLipetti opened this issue Nov 8, 2017 · 1 comment

Comments

@LilaLipetti
Copy link

While testing the OPC-UA, noticed that the attribute mappings and time series mappings doesn't work correctly.

While investigating the code in OpcUaDevice.java noticed following issue (lines 100-118):

public List<KvEntry> getAffectedAttributes(NodeId tagId, DataValue dataValue) {
        List<AttributesMapping> attributes = getAttributesMapping(tagId);
        if (attributes.size() > 0) {
            return getKvEntries(attributes);
        } else {
            return Collections.emptyList();
        }
    }

public List<TsKvEntry> getAffectedTimeseries(NodeId tagId, DataValue dataValue) {
        List<AttributesMapping> attributes = getAttributesMapping(tagId);
        if (attributes.size() > 0) {
            return getKvEntries(attributes).stream()
                    .map(kv -> new BasicTsKvEntry(dataValue.getSourceTime().getJavaTime(), kv))
                    .collect(Collectors.toList());
        } else {
            return Collections.emptyList();
        }
}

that in the getAffectedTimeseries the code is working against attribute mappings not against time series mappings.

The getAffectedTimeseries should me more like

public List<TsKvEntry> getAffectedTimeseries(NodeId tagId, DataValue dataValue) {
        List<TimeseriesMapping> tsattributes = getTimeseriesMapping(tagId);
        if (tsattributes.size() > 0) {
            return getKvEntries(tsattributes).stream()
                    .map(kv -> new BasicTsKvEntry(dataValue.getSourceTime().getJavaTime(), kv))
                    .collect(Collectors.toList());
        } else {
            return Collections.emptyList();
        }
}
@mp-loki
Copy link
Contributor

mp-loki commented Mar 15, 2018

Fixed in ThingsBoard Gateway versions 1.2.2 and 1.4.0

@mp-loki mp-loki closed this as completed Mar 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants