@halsystems/red-bacnet 1.3.0 → 1.4.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.4.1]
4
+ ### Changed
5
+ - `discover_point` allows device id to be null, to discover based on IP configuration
6
+
7
+ ## [1.4.0]
8
+ ### Changed
9
+ - `read_point` readMethod removed `Read Multiple Fallback Single` option
10
+
11
+ ### Fixed
12
+ - Fixed dummy event emitter not catching output and error
13
+ - Fixed read point event emitter not catching error
14
+
3
15
  ## [1.3.0]
4
16
  ### Added
5
17
  - WritePoint added concurrentTaskDelay config to control delay between concurrent tasks
package/common/bacnet.js CHANGED
@@ -6,7 +6,7 @@ const EventEmitter = require('events');
6
6
  const bacnet = require('@root/ext/node-bacstack/dist/index.js')
7
7
  const baEnum = bacnet.enum;
8
8
 
9
- const { EVENT_ERROR } = require('@root/common/core/constant.js')
9
+ const { EVENT_ERROR, EVENT_OUTPUT } = require('@root/common/core/constant.js')
10
10
  const { concurrentTasks } = require('@root/common/core/concurrent.js')
11
11
  const { getErrMsg } = require('@root/common/func.js')
12
12
 
@@ -266,6 +266,9 @@ module.exports = {
266
266
  let failedCount = 0
267
267
  let result_single = []
268
268
  const dummyEventEmitter = new EventEmitter();
269
+ dummyEventEmitter.on(EVENT_OUTPUT, () => { });
270
+ dummyEventEmitter.on(EVENT_ERROR, () => { });
271
+
269
272
  const tasks = reqArr.slice(reqArrIndexNext).flatMap((req, x) =>
270
273
  req.properties.map((prop, y) => ({
271
274
  id: `${x}-${y}`,
@@ -100,6 +100,10 @@ module.exports = {
100
100
  device,
101
101
  { stripUnknown: true }
102
102
  );
103
+ // if device id is null, set to 4194303
104
+ if (result.deviceId == null)
105
+ result.deviceId = 4194303;
106
+
103
107
  if (error) {
104
108
  this.eventEmitter.emit(EVENT_ERROR, errMsg(
105
109
  this.name, ERR_SCHEMA_VALIDATION, error
@@ -223,6 +223,10 @@ module.exports = {
223
223
  count++;
224
224
  });
225
225
 
226
+ smartReadEvent.on(EVENT_ERROR, (data) => {
227
+ this.eventEmitter.emit(EVENT_ERROR, data)
228
+ });
229
+
226
230
  const tasks = entries
227
231
  .filter(([_, v]) => Array.isArray(v.points) && v.points.length > 0) // eslint-disable-line
228
232
  .map(([k, v]) => ({
package/common/schema.js CHANGED
@@ -6,7 +6,7 @@ const Joi = require('joi');
6
6
  module.exports = {
7
7
  bacnetDeviceSchema: Joi.object({
8
8
  deviceName: Joi.string().allow('').default(''),
9
- deviceId: Joi.number().min(0).max(4194302).required(),
9
+ deviceId: Joi.number().min(0).max(4194303).allow(null).required(),
10
10
  network: Joi.number().min(0).max(65534).allow(null).default(null),
11
11
  ipAddress: Joi.string().required().custom((value, helpers) => {
12
12
  const [ip, port] = value.split(':');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halsystems/red-bacnet",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
4
4
  "description": "NodeRED BACnet IP client",
5
5
  "email": "open_source@halsystems.com.au",
6
6
  "repository": {
@@ -33,8 +33,7 @@
33
33
  <label for="node-input-readMethod"><i class="fa fa-list"></i> Read Method</label>
34
34
  <select id="node-input-readMethod">
35
35
  <option value="0">Read Single Only</option>
36
- <option value="1">Read Multiple Fallback Single</option>
37
- <option value="2">Comprehensive Read</option>
36
+ <option value="1">Comprehensive Read</option>
38
37
  </select>
39
38
  </div>
40
39
  <div class="form-row">
@@ -62,8 +61,7 @@
62
61
 
63
62
  <dt>readMethod<span class="property-type">number</span></dt>
64
63
  <dd> <b>Read Single Only</b>: use <code>readProperty</code></dd>
65
- <dd> <b>Read Multiple Fallback Single</b>: try <code>readPropertyMultiple</code> with consevative query size, fallback to <code>readProperty</code> if failed</dd>
66
- <dd> <b>Comprehensive Read</b>: try <code>readPropertyMultiple</code> twice with high and conservative query size,fallback to <code>readProperty</code> if failed</dd>
64
+ <dd> <b>Comprehensive Read</b>: try <code>readPropertyMultiple</code>, reduce query size if failed, and fallback to <code>readProperty</code> if query size reduced to 1</dd>
67
65
 
68
66
  <dt>maxConcurrentDeviceRead<span class="property-type">number</span></dt>
69
67
  <dd> Devices count to discover simultaneously.</dd>