@things-factory/integration-opc 6.1.122 → 6.1.124

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/integration-opc",
3
- "version": "6.1.122",
3
+ "version": "6.1.124",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -23,8 +23,8 @@
23
23
  "clean": "npm run clean:server"
24
24
  },
25
25
  "dependencies": {
26
- "@things-factory/integration-base": "^6.1.122",
26
+ "@things-factory/integration-base": "^6.1.123",
27
27
  "node-opcua": "^2.110.0"
28
28
  },
29
- "gitHead": "01735af77d98fa26fbcc312e9b982eee1638114d"
29
+ "gitHead": "206aa7c2b8d4d5cf73ceb282be740fb6aec44308"
30
30
  }
@@ -77,8 +77,8 @@ export class OPCUAConnector implements Connector {
77
77
 
78
78
  try {
79
79
  ConnectionManager.addConnectionInstance(config, {
80
- read: async function (node, { logger }): Promise<DataValue> {
81
- const dataValue = await session.read({ nodeId: node, attributeId: AttributeIds.Value })
80
+ read: async function (node, attribute, { logger }): Promise<DataValue> {
81
+ const dataValue = await session.read({ nodeId: node, attributeId: Number(attribute) })
82
82
  if (dataValue.statusCode !== StatusCodes.Good) {
83
83
  logger.info('Could not read ', node)
84
84
  }
@@ -2,3 +2,4 @@ import './opc-ua-read'
2
2
  import './opc-ua-write'
3
3
  import './opc-ua-start-monitor'
4
4
  import './opc-ua-stop-monitor'
5
+ import './utils'
@@ -1,10 +1,11 @@
1
1
  import { ConnectionManager, TaskRegistry } from '@things-factory/integration-base'
2
- import { DataValue } from 'node-opcua'
2
+ import { DataType, DataValue, AttributeIds } from 'node-opcua'
3
+ import { DataTypeString } from './utils'
3
4
 
4
5
  async function OPCUARead(step, { logger, domain }) {
5
6
  var {
6
7
  connection,
7
- params: { node }
8
+ params: { node, attribute }
8
9
  } = step
9
10
 
10
11
  var client = ConnectionManager.getConnectionInstanceByName(domain, connection)
@@ -17,11 +18,11 @@ async function OPCUARead(step, { logger, domain }) {
17
18
  }
18
19
 
19
20
  var { read } = client
20
- var content: DataValue = await read(node, { logger })
21
+ var content: DataValue = await read(node, attribute, { logger })
21
22
 
22
23
  return {
23
24
  data: {
24
- dataType: content?.value.dataType,
25
+ dataType: DataTypeString[content?.value.dataType],
25
26
  value: content?.value.value
26
27
  }
27
28
  }
@@ -32,6 +33,42 @@ OPCUARead.parameterSpec = [
32
33
  type: 'string',
33
34
  name: 'node',
34
35
  label: 'node'
36
+ },
37
+ {
38
+ type: 'select',
39
+ label: 'attribute',
40
+ name: 'attribute',
41
+ property: {
42
+ options: [
43
+ { display: 'Value', value: AttributeIds.Value },
44
+ { display: 'DataType', value: AttributeIds.DataType },
45
+ { display: 'NodeId', value: AttributeIds.NodeId },
46
+ { display: 'NodeClass', value: AttributeIds.NodeClass },
47
+ { display: 'BrowseName', value: AttributeIds.BrowseName },
48
+ { display: 'DisplayName', value: AttributeIds.DisplayName },
49
+ { display: 'Description', value: AttributeIds.Description },
50
+ { display: 'WriteMask', value: AttributeIds.WriteMask },
51
+ { display: 'UserWriteMask', value: AttributeIds.UserWriteMask },
52
+ { display: 'IsAbstract', value: AttributeIds.IsAbstract },
53
+ { display: 'Symmetric', value: AttributeIds.Symmetric },
54
+ { display: 'InverseName', value: AttributeIds.InverseName },
55
+ { display: 'ContainsNoLoops', value: AttributeIds.ContainsNoLoops },
56
+ { display: 'EventNotifier', value: AttributeIds.EventNotifier },
57
+ { display: 'ValueRank', value: AttributeIds.ValueRank },
58
+ { display: 'ArrayDimensions', value: AttributeIds.ArrayDimensions },
59
+ { display: 'AccessLevel', value: AttributeIds.AccessLevel },
60
+ { display: 'UserAccessLevel', value: AttributeIds.UserAccessLevel },
61
+ { display: 'MinimumSamplingInterval', value: AttributeIds.MinimumSamplingInterval },
62
+ { display: 'Historizing', value: AttributeIds.Historizing },
63
+ { display: 'Executable', value: AttributeIds.Executable },
64
+ { display: 'UserExecutable', value: AttributeIds.UserExecutable },
65
+ { display: 'DataTypeDefinition', value: AttributeIds.DataTypeDefinition },
66
+ { display: 'RolePermissions', value: AttributeIds.RolePermissions },
67
+ { display: 'UserRolePermissions', value: AttributeIds.UserRolePermissions },
68
+ { display: 'AccessRestrictions', value: AttributeIds.AccessRestrictions },
69
+ { display: 'AccessLevelEx', value: AttributeIds.AccessLevelEx }
70
+ ]
71
+ }
35
72
  }
36
73
  ]
37
74
 
@@ -0,0 +1,30 @@
1
+ import { DataType } from 'node-opcua'
2
+
3
+ export const DataTypeString = {
4
+ [DataType.Null]: 'Null',
5
+ [DataType.Boolean]: 'Boolean',
6
+ [DataType.SByte]: 'SByte',
7
+ [DataType.Byte]: 'Byte',
8
+ [DataType.Int16]: 'Int16',
9
+ [DataType.UInt16]: 'UInt16',
10
+ [DataType.Int32]: 'Int32',
11
+ [DataType.UInt32]: 'UInt32',
12
+ [DataType.Int64]: 'Int64',
13
+ [DataType.UInt64]: 'UInt64',
14
+ [DataType.Float]: 'Float',
15
+ [DataType.Double]: 'Double',
16
+ [DataType.String]: 'String',
17
+ [DataType.DateTime]: 'DateTime',
18
+ [DataType.Guid]: 'Guid',
19
+ [DataType.ByteString]: 'ByteString',
20
+ [DataType.XmlElement]: 'XmlElement',
21
+ [DataType.NodeId]: 'NodeId',
22
+ [DataType.ExpandedNodeId]: 'ExpandedNodeId',
23
+ [DataType.StatusCode]: 'StatusCode',
24
+ [DataType.QualifiedName]: 'QualifiedName',
25
+ [DataType.LocalizedText]: 'LocalizedText',
26
+ [DataType.ExtensionObject]: 'ExtensionObject',
27
+ [DataType.DataValue]: 'DataValue',
28
+ [DataType.Variant]: 'Variant',
29
+ [DataType.DiagnosticInfo]: 'DiagnosticInfo'
30
+ }
@@ -15,5 +15,6 @@
15
15
  "label.monitor-item": "monitor item",
16
16
  "label.product-name": "product name",
17
17
  "label.build-number": "build number",
18
- "label.build-date": "build date"
18
+ "label.build-date": "build date",
19
+ "label.attribute": "attribute"
19
20
  }
@@ -15,5 +15,6 @@
15
15
  "label.monitor-item": "monitor item",
16
16
  "label.product-name": "product name",
17
17
  "label.build-number": "build number",
18
- "label.build-date": "build date"
18
+ "label.build-date": "build date",
19
+ "label.attribute": "attribute"
19
20
  }
@@ -15,5 +15,6 @@
15
15
  "label.monitor-item": "monitor item",
16
16
  "label.product-name": "product name",
17
17
  "label.build-number": "build number",
18
- "label.build-date": "build date"
18
+ "label.build-date": "build date",
19
+ "label.attribute": "attribute"
19
20
  }
@@ -15,5 +15,6 @@
15
15
  "label.monitor-item": "monitor item",
16
16
  "label.product-name": "product name",
17
17
  "label.build-number": "build number",
18
- "label.build-date": "build date"
18
+ "label.build-date": "build date",
19
+ "label.attribute": "attribute"
19
20
  }
@@ -15,5 +15,6 @@
15
15
  "label.monitor-item": "monitor item",
16
16
  "label.product-name": "product name",
17
17
  "label.build-number": "build number",
18
- "label.build-date": "build date"
18
+ "label.build-date": "build date",
19
+ "label.attribute": "attribute"
19
20
  }