@bitpoolos/edge-bacnet 1.1.7 → 1.1.8

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/README.md CHANGED
@@ -9,7 +9,7 @@ A Node-RED node that reads and writes to BACnet devices.
9
9
 
10
10
  ## Getting Started
11
11
 
12
- Use the procedures below to install the Bitpool-Edge BACnet node onto your running instance. Then either use the Node-RED help, or read the [wiki](https://wiki.bitpool.com/en/edge/apps/bitpool-edge/nr-bacnet) page to get you started on your next new project.
12
+ Use the procedures below to install the Bitpool-Edge BACnet node onto your running instance. Then either use the Node-RED help, or read the [wiki](https://wiki.bitpool.com/bitpool-edge/connectors/bitpool-edge-bacnet) page to get you started on your next new project.
13
13
 
14
14
  *- Examples are available using the Import->Examples->Flows menu.*
15
15
 
@@ -50,7 +50,7 @@ $ npm install @bitpoolos/edge-bacnet
50
50
 
51
51
  ## Contributions
52
52
 
53
- This node utilises v0.0.1-beta.13 of the node-bacstack package (https://github.com/fh1ch/node-bacstack). None of the functionality here would be possible without the fantastic work done by the contributors of that project.
53
+ This node utilises v0.2.4 of the node-bacnet package (https://github.com/BiancoRoyal/node-bacstack). None of the functionality here would be possible without the fantastic work done by the contributors of that project.
54
54
 
55
55
  ## License
56
56
 
package/bacnet_server.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const bacnet = require('./resources/node-bacnet/index.js');
2
+ const pjson = require('./package.json');
2
3
  const baEnum = bacnet.enum;
3
4
  const {Store_Config_Server, Read_Config_Sync_Server } = require('./common');
4
5
 
@@ -15,17 +16,51 @@ class BacnetServer {
15
16
  ];
16
17
  that.objectStore = {
17
18
  [baEnum.ObjectType.DEVICE]: {
18
- [baEnum.PropertyIdentifier.OBJECT_IDENTIFIER]: [{value: {type: baEnum.ObjectType.DEVICE, instance: that.deviceId}, type: 12}], // OBJECT_IDENTIFIER
19
- [baEnum.PropertyIdentifier.OBJECT_LIST]: that.objectList, // OBJECT_IDENTIFIER
20
- [baEnum.PropertyIdentifier.OBJECT_NAME]: [{value: 'Bitpool Edge BACnet Gateway', type: 7}], // OBJECT_NAME
21
- [baEnum.PropertyIdentifier.OBJECT_TYPE]: [{value: 8, type: 9}], // OBJECT_TYPE
22
- [baEnum.PropertyIdentifier.DESCRIPTION]: [{value: 'Bitpool Edge BACnet gateway', type: 7}], // DESCRIPTION
23
- [baEnum.PropertyIdentifier.SYSTEM_STATUS]: [{value: 0, type: 9}], // SYSTEM_STATUS
24
- [baEnum.PropertyIdentifier.VENDOR_NAME]: [{value: "Bitpool", type: 7}], //VENDOR_NAME
25
- [baEnum.PropertyIdentifier.VENDOR_IDENTIFIER]: [{value: 1401, type: 7}], //VENDOR_IDENTIFIER
26
- [baEnum.PropertyIdentifier.MODEL_NAME]: [{value: "bitpool-edge", type: 7}], //MODEL_NAME
27
- [baEnum.PropertyIdentifier.FIRMWARE_REVISION]: [{value: "Node-Red " + that.nodeRedVersion, type: 7}], //FIRMWARE_REVISION
28
- },
19
+ [baEnum.PropertyIdentifier.OBJECT_IDENTIFIER]: [{value: {type: baEnum.ObjectType.DEVICE, instance: that.deviceId}, type: 12}],
20
+ [baEnum.PropertyIdentifier.OBJECT_LIST]: that.objectList,
21
+ [baEnum.PropertyIdentifier.OBJECT_NAME]: [{value: 'Bitpool Edge BACnet Gateway', type: 7}],
22
+ [baEnum.PropertyIdentifier.OBJECT_TYPE]: [{value: 8, type: 9}],
23
+ [baEnum.PropertyIdentifier.DESCRIPTION]: [{value: 'Bitpool Edge BACnet gateway', type: 7}],
24
+ [baEnum.PropertyIdentifier.SYSTEM_STATUS]: [{value: 0, type: 9}],
25
+ [baEnum.PropertyIdentifier.VENDOR_NAME]: [{value: "Bitpool", type: 7}],
26
+ [baEnum.PropertyIdentifier.VENDOR_IDENTIFIER]: [{value: 1401, type: 2}],
27
+ [baEnum.PropertyIdentifier.MODEL_NAME]: [{value: "bitpool-edge", type: 7}],
28
+ [baEnum.PropertyIdentifier.FIRMWARE_REVISION]: [{value: "Node-Red " + that.nodeRedVersion, type: 7}],
29
+ [baEnum.PropertyIdentifier.PROTOCOL_REVISION]: [{value: 19, type: 2}],
30
+ [baEnum.PropertyIdentifier.PROTOCOL_VERSION]: [{value: 0, type: 2}],
31
+ [baEnum.PropertyIdentifier.APPLICATION_SOFTWARE_VERSION]: [{value: pjson.version, type: 7}],
32
+ [baEnum.PropertyIdentifier.PROTOCOL_SERVICES_SUPPORTED]: [{value: { value: [ 0, 80, 0, 4, 4 ], bitsUsed: 40 }, type: 8}],
33
+ [baEnum.PropertyIdentifier.PROTOCOL_OBJECT_TYPES_SUPPORTED]: [{value: { value: [ 0, 80, 0, 4, 4 ], bitsUsed: 40 }, type: 8}],
34
+ [baEnum.PropertyIdentifier.MAX_APDU_LENGTH_ACCEPTED]: [{value: 1476, type: 2}],
35
+ [baEnum.PropertyIdentifier.SEGMENTATION_SUPPORTED]: [{value: 0, type: 9}],
36
+ [baEnum.PropertyIdentifier.APDU_TIMEOUT]: [{value: that.bacnetClient.config.apduTimeout, type: 2}],
37
+ [baEnum.PropertyIdentifier.NUMBER_OF_APDU_RETRIES]: [{value: 3, type: 2}],
38
+ [baEnum.PropertyIdentifier.DEVICE_ADDRESS_BINDING]: [{value: 0, type: 12}],
39
+ [baEnum.PropertyIdentifier.DATABASE_REVISION]: [{value: 19, type: 2}],
40
+ [baEnum.PropertyIdentifier.PROPERTY_LIST]: [
41
+ {value: baEnum.PropertyIdentifier.OBJECT_IDENTIFIER, type: 9 },
42
+ {value: baEnum.PropertyIdentifier.OBJECT_LIST, type: 9 },
43
+ {value: baEnum.PropertyIdentifier.OBJECT_NAME, type: 9 },
44
+ {value: baEnum.PropertyIdentifier.OBJECT_TYPE, type: 9 },
45
+ {value: baEnum.PropertyIdentifier.DESCRIPTION, type: 9 },
46
+ {value: baEnum.PropertyIdentifier.SYSTEM_STATUS, type: 9 },
47
+ {value: baEnum.PropertyIdentifier.VENDOR_NAME, type: 9 },
48
+ {value: baEnum.PropertyIdentifier.VENDOR_IDENTIFIER, type: 9 },
49
+ {value: baEnum.PropertyIdentifier.MODEL_NAME, type: 9 },
50
+ {value: baEnum.PropertyIdentifier.FIRMWARE_REVISION, type: 9 },
51
+ {value: baEnum.PropertyIdentifier.PROTOCOL_REVISION, type: 9 },
52
+ {value: baEnum.PropertyIdentifier.PROTOCOL_VERSION, type: 9 },
53
+ {value: baEnum.PropertyIdentifier.APPLICATION_SOFTWARE_VERSION, type: 9 },
54
+ {value: baEnum.PropertyIdentifier.PROTOCOL_SERVICES_SUPPORTED, type: 9 },
55
+ {value: baEnum.PropertyIdentifier.PROTOCOL_OBJECT_TYPES_SUPPORTED, type: 9 },
56
+ {value: baEnum.PropertyIdentifier.MAX_APDU_LENGTH_ACCEPTED, type: 9 },
57
+ {value: baEnum.PropertyIdentifier.SEGMENTATION_SUPPORTED, type: 9 },
58
+ {value: baEnum.PropertyIdentifier.APDU_TIMEOUT, type: 9 },
59
+ {value: baEnum.PropertyIdentifier.NUMBER_OF_APDU_RETRIES, type: 9 },
60
+ {value: baEnum.PropertyIdentifier.DEVICE_ADDRESS_BINDING, type: 9 },
61
+ {value: baEnum.PropertyIdentifier.DATABASE_REVISION, type: 9 },
62
+ ],
63
+ },
29
64
  [baEnum.ObjectType.ANALOG_VALUE]: [],
30
65
  [baEnum.ObjectType.CHARACTERSTRING_VALUE]: []
31
66
  };
@@ -45,7 +80,8 @@ class BacnetServer {
45
80
  }
46
81
 
47
82
  that.bacnetClient.client.on('whoIs', (device) => {
48
- that.bacnetClient.client.iAmResponse(that.bacnetClient.broadCastAddr, that.deviceId, baEnum.Segmentation.SEGMENTED_BOTH, 27823);
83
+ that.bacnetClient.client.iAmResponse(that.bacnetClient.broadCastAddr, that.deviceId, baEnum.Segmentation.SEGMENTED_BOTH, 1401);
84
+ that.lastWhoIsRecived = Date.now();
49
85
  });
50
86
 
51
87
  that.bacnetClient.client.on('readPropertyMultiple', (data) => {
@@ -70,7 +106,6 @@ class BacnetServer {
70
106
 
71
107
  if(i == requestProps.length - 1) {
72
108
  if(responseObject.length > 0) {
73
-
74
109
  that.bacnetClient.client.readPropertyMultipleResponse(senderAddress, data.invokeId, responseObject);
75
110
  } else {
76
111
  that.bacnetClient.client.errorResponse(
@@ -105,8 +140,11 @@ class BacnetServer {
105
140
  let propId = data.payload.property.id.toString();
106
141
  let responseObj = that.getObject(objectId, propId, objectInstance);
107
142
 
143
+ if(propId == baEnum.PropertyIdentifier.OBJECT_LIST && ((Date.now() - that.lastWhoIsRecived) / 1000) < 0.7) {
144
+ responseObj = [{value:that.objectList.length, type: 2}];
145
+ }
108
146
  if(responseObj !== null && responseObj !== undefined && typeof responseObj !== "undefined") {
109
- that.bacnetClient.client.readPropertyResponse(data.header.sender.address, data.invokeId, objectId, data.payload.property, responseObj);
147
+ that.bacnetClient.client.readPropertyResponse(data.header.sender.address, data.invokeId, data.payload.objectId, data.payload.property, responseObj);
110
148
  } else {
111
149
  that.bacnetClient.client.errorResponse(
112
150
  data.address,
@@ -152,7 +190,27 @@ class BacnetServer {
152
190
  [baEnum.PropertyIdentifier.STATUS_FLAGS]: [{value: 0, type: 8}],
153
191
  [baEnum.PropertyIdentifier.EVENT_STATE]: [{value: 0, type: 9}],
154
192
  [baEnum.PropertyIdentifier.OUT_OF_SERVICE]: [{value: 0, type: 9}],
155
- [baEnum.PropertyIdentifier.UNITS]: [{value: 95, type: 9}]
193
+ [baEnum.PropertyIdentifier.UNITS]: [{value: 95, type: 9}],
194
+ [baEnum.PropertyIdentifier.PRIORITY_ARRAY]: [{value: 0, type: 9}],
195
+ [baEnum.PropertyIdentifier.MAX_PRES_VALUE]: [{value: value, type: 4}],
196
+ [baEnum.PropertyIdentifier.MIN_PRES_VALUE]: [{value: value, type: 4}],
197
+ [baEnum.PropertyIdentifier.RESOLUTION]: [{value: 0, type: 4}],
198
+ [baEnum.PropertyIdentifier.PROPERTY_LIST]:
199
+ [
200
+ {value: baEnum.PropertyIdentifier.OBJECT_NAME, type: 9 },
201
+ {value: baEnum.PropertyIdentifier.OBJECT_TYPE, type: 9 },
202
+ {value: baEnum.PropertyIdentifier.DESCRIPTION, type: 9 },
203
+ {value: baEnum.PropertyIdentifier.OBJECT_IDENTIFIER, type: 9 },
204
+ {value: baEnum.PropertyIdentifier.PRESENT_VALUE, type: 9 },
205
+ {value: baEnum.PropertyIdentifier.STATUS_FLAGS, type: 9 },
206
+ {value: baEnum.PropertyIdentifier.EVENT_STATE, type: 9 },
207
+ {value: baEnum.PropertyIdentifier.OUT_OF_SERVICE, type: 9 },
208
+ {value: baEnum.PropertyIdentifier.UNITS, type: 9 },
209
+ {value: baEnum.PropertyIdentifier.PRIORITY_ARRAY, type: 9 },
210
+ {value: baEnum.PropertyIdentifier.MAX_PRES_VALUE, type: 9 },
211
+ {value: baEnum.PropertyIdentifier.MIN_PRES_VALUE, type: 9 },
212
+ {value: baEnum.PropertyIdentifier.RESOLUTION, type: 9 },
213
+ ],
156
214
  });
157
215
 
158
216
  that.objectList.push({value: {type: baEnum.ObjectType.ANALOG_VALUE, instance: objectId}, type: 12})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitpoolos/edge-bacnet",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "A bacnet gateway for node-red",
5
5
  "dependencies": {
6
6
  "async-mutex": "^0.4.0",