@halsystems/red-bacnet 1.1.5 → 1.3.0

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,6 +1,17 @@
1
1
  # Changelog
2
2
 
3
- ## [1.1.4]
3
+ ## [1.3.0]
4
+ ### Added
5
+ - WritePoint added concurrentTaskDelay config to control delay between concurrent tasks
6
+
7
+ ### Changed
8
+ - Default maxConcurrentDeviceRead to 1 for discover_point, read_point and write_point
9
+
10
+ ## [1.2.0]
11
+ ### Added
12
+ - DiscoverPoint and ReadPoint added concurrentTaskDelay config to control delay between concurrent tasks
13
+
14
+ ## [1.1.5]
4
15
  ### Change
5
16
  - ReadPoint to not add device to task queue if no points attached to device
6
17
 
package/common/bacnet.js CHANGED
@@ -568,19 +568,26 @@ module.exports = {
568
568
  }
569
569
 
570
570
  return new Promise((resolve, reject) => {
571
+ // Build options only if priority is provided
572
+ const options = {};
573
+ if (priority !== null && priority !== undefined) {
574
+ options.priority = priority;
575
+ }
576
+
571
577
  client.writeProperty(
572
578
  addressSet,
573
579
  objectId,
574
580
  propertyId,
575
581
  writeValue,
576
- { priority: priority },
582
+ options, // may be empty if no priority
577
583
  (err) => {
578
584
  if (err) {
579
585
  reject(err);
580
- }
581
- else
586
+ } else {
582
587
  resolve(true);
583
- });
588
+ }
589
+ }
590
+ );
584
591
  });
585
592
  },
586
593
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halsystems/red-bacnet",
3
- "version": "1.1.5",
3
+ "version": "1.3.0",
4
4
  "description": "NodeRED BACnet IP client",
5
5
  "email": "open_source@halsystems.com.au",
6
6
  "repository": {
@@ -8,8 +8,9 @@
8
8
  discoverMode: { value: 0, required: true, validate: RED.validators.number() },
9
9
  readMethod: { value: 2, required: true, validate: RED.validators.number() },
10
10
  groupExportDeviceCount: { value: 30000, required: true, validate: RED.validators.number() },
11
- maxConcurrentDeviceRead: { value: 3, required: true, validate: RED.validators.number() },
11
+ maxConcurrentDeviceRead: { value: 1, required: true, validate: RED.validators.number() },
12
12
  maxConcurrentSinglePointRead: { value: 10, required: true, validate: RED.validators.number() },
13
+ concurrentTaskDelay: { value: 0, required: true, validate: RED.validators.number() },
13
14
  },
14
15
  inputs: 1,
15
16
  outputs: 1,
@@ -51,12 +52,16 @@
51
52
  </div>
52
53
  <div class="form-row">
53
54
  <label for="node-input-maxConcurrentDeviceRead"><i class="fa fa-tag"></i> Max Concurrent Device Read</label>
54
- <input type="number" id="node-input-maxConcurrentDeviceRead" placeholder="3" , min="1" , max="1000">
55
+ <input type="number" id="node-input-maxConcurrentDeviceRead" placeholder="1" , min="1" , max="1000">
55
56
  </div>
56
57
  <div class="form-row">
57
58
  <label for="node-input-maxConcurrentSinglePointRead"><i class="fa fa-tag"></i> Max Concurrent Single Point Read</label>
58
59
  <input type="number" id="node-input-maxConcurrentSinglePointRead" placeholder="10" , min="1" , max="1000">
59
60
  </div>
61
+ <div class="form-row">
62
+ <label for="node-input-concurrentTaskDelay"><i class="fa fa-tag"></i> Concurrent Task Delay (ms)</label>
63
+ <input type="number" id="node-input-concurrentTaskDelay" placeholder="0" min="0" max="10000">
64
+ </div>
60
65
  </script>
61
66
 
62
67
  <script type="text/html" data-help-name="discover point">
@@ -86,6 +91,9 @@
86
91
  <dt>maxConcurrentSinglePointRead<span class="property-type">number</span></dt>
87
92
  <dd> Number of points to read simultaneously when using <code>readProperty</code> mode</dd>
88
93
  <dd> <b>USE WITH CAUTION!</b> Reduce to low value if field BACnet device is underpowered</dd>
94
+
95
+ <dt>concurrentTaskDelay<span class="property-type">number</span></dt>
96
+ <dd> Delay in milliseconds between device reading</dd>
89
97
  </dl>
90
98
 
91
99
  <h3>Inputs</h3>
@@ -105,4 +113,4 @@
105
113
  <h3>Details</h3>
106
114
  <p>If node is triggered while existing job is running, new job will be coalesced if <code>msg.id</code> are identical, else new job will be put in queue until current job is completed.</p>
107
115
 
108
- </script>
116
+ </script>
@@ -25,6 +25,7 @@ module.exports = function (RED) {
25
25
  this.groupExportDeviceCount = +config.groupExportDeviceCount
26
26
  this.maxConcurrentDeviceRead = +config.maxConcurrentDeviceRead
27
27
  this.maxConcurrentSinglePointRead = +config.maxConcurrentSinglePointRead
28
+ this.concurrentTaskDelay = +config.concurrentTaskDelay
28
29
 
29
30
  // events
30
31
  this.#subscribeListeners();
@@ -43,7 +44,7 @@ module.exports = function (RED) {
43
44
  const task = new DiscoverPointJob(
44
45
  this.client, this.#eventEmitter, msg?.devices, this.discoverMode, this.readMethod,
45
46
  this.groupExportDeviceCount, this.maxConcurrentDeviceRead,
46
- this.maxConcurrentSinglePointRead
47
+ this.maxConcurrentSinglePointRead, this.concurrentTaskDelay
47
48
  );
48
49
 
49
50
  this.job.addJob({
@@ -79,4 +80,3 @@ module.exports = function (RED) {
79
80
  // ----- register node -----
80
81
  RED.nodes.registerType('discover point', DiscoverPoint);
81
82
  }
82
-
@@ -6,8 +6,9 @@
6
6
  name: { value: "" },
7
7
  client: { type: "bacnet client", required: true },
8
8
  readMethod: { value: 1, required: true, validate: RED.validators.number() },
9
- maxConcurrentDeviceRead: { value: 3, required: true, validate: RED.validators.number() },
9
+ maxConcurrentDeviceRead: { value: 1, required: true, validate: RED.validators.number() },
10
10
  maxConcurrentSinglePointRead: { value: 10, required: true, validate: RED.validators.number() },
11
+ concurrentTaskDelay: { value: 0, required: true, validate: RED.validators.number() },
11
12
  },
12
13
  inputs: 1,
13
14
  outputs: 1,
@@ -38,13 +39,17 @@
38
39
  </div>
39
40
  <div class="form-row">
40
41
  <label for="node-input-maxConcurrentDeviceRead"><i class="fa fa-tag"></i> Max Concurrent Device Read</label>
41
- <input type="number" id="node-input-maxConcurrentDeviceRead" placeholder="3" , min="1" , max="1000">
42
+ <input type="number" id="node-input-maxConcurrentDeviceRead" placeholder="1" , min="1" , max="1000">
42
43
  </div>
43
44
  <div class="form-row">
44
45
  <label for="node-input-maxConcurrentSinglePointRead"><i class="fa fa-tag"></i> Max Concurrent Single Point
45
46
  Read</label>
46
47
  <input type="number" id="node-input-maxConcurrentSinglePointRead" placeholder="10" , min="1" , max="1000">
47
48
  </div>
49
+ <div class="form-row">
50
+ <label for="node-input-concurrentTaskDelay"><i class="fa fa-tag"></i> Concurrent Task Delay (ms)</label>
51
+ <input type="number" id="node-input-concurrentTaskDelay" placeholder="0" , min="0" , max="10000">
52
+ </div>
48
53
  </script>
49
54
 
50
55
  <script type="text/html" data-help-name="read point">
@@ -68,6 +73,11 @@
68
73
  <dt>maxConcurrentSinglePointRead<span class="property-type">number</span></dt>
69
74
  <dd> Number of points to read simultaneously when using <code>readProperty</code> mode</dd>
70
75
  <dd> <b>USE WITH CAUTION!</b> Reduce to low value if field BACnet device is underpowered</dd>
76
+ </dd>
77
+
78
+ <dt>concurrentTaskDelay<span class="property-type">number</span></dt>
79
+ <dd> Delay in milliseconds between reading points from different devices</dd>
80
+ <dd> <b>USE WITH CAUTION!</b> Increase value on slow or congested networks</dd>
71
81
  </dl>
72
82
  </dl>
73
83
 
@@ -91,4 +101,4 @@
91
101
 
92
102
  <h3>Details</h3>
93
103
  <p>If node is triggered while existing job is running, new job will be coalesced if <code>msg.id</code> are identical, else new job will be put in queue until current job is completed.</p>
94
- </script>
104
+ </script>
@@ -24,6 +24,7 @@ module.exports = function (RED) {
24
24
  this.readMethod = +config.readMethod
25
25
  this.maxConcurrentDeviceRead = +config.maxConcurrentDeviceRead
26
26
  this.maxConcurrentSinglePointRead = +config.maxConcurrentSinglePointRead
27
+ this.concurrentTaskDelay = +config.concurrentTaskDelay
27
28
 
28
29
  // events
29
30
  this.#subscribeListeners();
@@ -46,7 +47,8 @@ module.exports = function (RED) {
46
47
  msg.points,
47
48
  this.readMethod,
48
49
  this.maxConcurrentDeviceRead,
49
- this.maxConcurrentSinglePointRead
50
+ this.maxConcurrentSinglePointRead,
51
+ this.concurrentTaskDelay
50
52
  );
51
53
 
52
54
  this.job.addJob({
@@ -82,4 +84,3 @@ module.exports = function (RED) {
82
84
  // ----- register node -----
83
85
  RED.nodes.registerType('read point', ReadPoint);
84
86
  }
85
-
@@ -5,8 +5,9 @@
5
5
  defaults: {
6
6
  name: { value: "" },
7
7
  client: { type: "bacnet client", required: true },
8
- maxConcurrentDeviceWrite: { value: 3, required: true, validate: RED.validators.number() },
8
+ maxConcurrentDeviceWrite: { value: 1, required: true, validate: RED.validators.number() },
9
9
  maxConcurrentPointWrite: { value: 5, required: true, validate: RED.validators.number() },
10
+ concurrentTaskDelay: { value: 0, required: true, validate: RED.validators.number() },
10
11
  },
11
12
  inputs: 1,
12
13
  outputs: 1,
@@ -29,12 +30,16 @@
29
30
  </div>
30
31
  <div class="form-row">
31
32
  <label for="node-input-maxConcurrentDeviceWrite"><i class="fa fa-tag"></i> Max Concurrent Device Write</label>
32
- <input type="number" id="node-input-maxConcurrentDeviceWrite" placeholder="3" , min="1" , max="1000">
33
+ <input type="number" id="node-input-maxConcurrentDeviceWrite" placeholder="1" , min="1" , max="1000">
33
34
  </div>
34
35
  <div class="form-row">
35
36
  <label for="node-input-maxConcurrentPointWrite"><i class="fa fa-tag"></i> Max Concurrent Point Write</label>
36
37
  <input type="number" id="node-input-maxConcurrentPointWrite" placeholder="5" , min="1" , max="1000">
37
38
  </div>
39
+ <div class="form-row">
40
+ <label for="node-input-concurrentTaskDelay"><i class="fa fa-tag"></i> Concurrent Task Delay</label>
41
+ <input type="number" id="node-input-concurrentTaskDelay" placeholder="0" , min="0" , max="10000">
42
+ </div>
38
43
  </script>
39
44
 
40
45
  <script type="text/html" data-help-name="write point">
@@ -52,6 +57,9 @@
52
57
  <dt>maxConcurrentPointWrite<span class="property-type">number</span></dt>
53
58
  <dd> Number of points to write simultaneously</dd>
54
59
  <dd> <b>USE WITH CAUTION!</b> Reduce to low value if field BACnet device is underpowered</dd>
60
+
61
+ <dt>concurrentTaskDelay<span class="property-type">number</span></dt>
62
+ <dd> Delay in milliseconds between delay writing</dd>
55
63
  </dl>
56
64
 
57
65
  <h3>Inputs</h3>
@@ -73,4 +81,4 @@
73
81
 
74
82
  <h3>Details</h3>
75
83
  <p>If node is triggered while existing job is running, new job will be coalesced if <code>msg.id</code> are identical, else new job will be put in queue until current job is completed.</p>
76
- </script>
84
+ </script>
@@ -23,6 +23,7 @@ module.exports = function (RED) {
23
23
  this.client = RED.nodes.getNode(config.client).instance;
24
24
  this.maxConcurrentDeviceWrite = +config.maxConcurrentDeviceWrite
25
25
  this.maxConcurrentPointWrite = +config.maxConcurrentPointWrite
26
+ this.concurrentTaskDelay = +config.concurrentTaskDelay
26
27
 
27
28
  // events
28
29
  this.#subscribeListeners();
@@ -45,7 +46,8 @@ module.exports = function (RED) {
45
46
  msg.points,
46
47
  msg.writePoints,
47
48
  this.maxConcurrentDeviceWrite,
48
- this.maxConcurrentPointWrite
49
+ this.maxConcurrentPointWrite,
50
+ this.concurrentTaskDelay
49
51
  );
50
52
 
51
53
  this.job.addJob({
@@ -81,4 +83,3 @@ module.exports = function (RED) {
81
83
  // ----- register node -----
82
84
  RED.nodes.registerType('write point', WritePoint);
83
85
  }
84
-