@halsystems/red-bacnet 1.1.4 → 1.2.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 +8 -0
- package/common/bacnet.js +11 -4
- package/common/job/read_point.js +12 -10
- package/package.json +1 -1
- package/red-bacnet/discover_point.html +9 -1
- package/red-bacnet/discover_point.js +2 -2
- package/red-bacnet/read_point.html +11 -1
- package/red-bacnet/read_point.js +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.2.0]
|
|
4
|
+
### Added
|
|
5
|
+
- DiscoverPoint and ReadPoint added concurrentTaskDelay config to control delay between concurrent tasks
|
|
6
|
+
|
|
7
|
+
## [1.1.5]
|
|
8
|
+
### Change
|
|
9
|
+
- ReadPoint to not add device to task queue if no points attached to device
|
|
10
|
+
|
|
3
11
|
## [1.1.4]
|
|
4
12
|
### Added
|
|
5
13
|
- DiscoverPoint added new discover mode: Analog and Binary only
|
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
|
-
|
|
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/common/job/read_point.js
CHANGED
|
@@ -211,7 +211,7 @@ module.exports = {
|
|
|
211
211
|
smartReadEvent.on(EVENT_OUTPUT, (data) => {
|
|
212
212
|
this.#updateProgress(
|
|
213
213
|
Math.round((85 / size) * (count + 1) + 10)
|
|
214
|
-
)
|
|
214
|
+
);
|
|
215
215
|
|
|
216
216
|
if (Array.isArray(data.result))
|
|
217
217
|
data.result.forEach(i => {
|
|
@@ -223,15 +223,17 @@ module.exports = {
|
|
|
223
223
|
count++;
|
|
224
224
|
});
|
|
225
225
|
|
|
226
|
-
const tasks = entries
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
226
|
+
const tasks = entries
|
|
227
|
+
.filter(([_, v]) => Array.isArray(v.points) && v.points.length > 0) // eslint-disable-line
|
|
228
|
+
.map(([k, v]) => ({
|
|
229
|
+
id: k,
|
|
230
|
+
task: async () => {
|
|
231
|
+
return await smartReadProperty(
|
|
232
|
+
this.client, v.device, v.points, this.readMethod,
|
|
233
|
+
this.maxConcurrentSinglePointRead, 10, this.concurrentTaskDelay
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
}));
|
|
235
237
|
|
|
236
238
|
await concurrentTasks(smartReadEvent, tasks, this.maxConcurrentDeviceRead);
|
|
237
239
|
|
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
groupExportDeviceCount: { value: 30000, required: true, validate: RED.validators.number() },
|
|
11
11
|
maxConcurrentDeviceRead: { value: 3, required: true, validate: RED.validators.number() },
|
|
12
12
|
maxConcurrentSinglePointRead: { value: 10, required: true, validate: RED.validators.number() },
|
|
13
|
+
concurrentTaskDelay: { value: 10, required: true, validate: RED.validators.number() },
|
|
13
14
|
},
|
|
14
15
|
inputs: 1,
|
|
15
16
|
outputs: 1,
|
|
@@ -57,6 +58,10 @@
|
|
|
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="10" 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
|
-
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
readMethod: { value: 1, required: true, validate: RED.validators.number() },
|
|
9
9
|
maxConcurrentDeviceRead: { value: 3, required: true, validate: RED.validators.number() },
|
|
10
10
|
maxConcurrentSinglePointRead: { value: 10, required: true, validate: RED.validators.number() },
|
|
11
|
+
concurrentTaskDelay: { value: 10, required: true, validate: RED.validators.number() },
|
|
11
12
|
},
|
|
12
13
|
inputs: 1,
|
|
13
14
|
outputs: 1,
|
|
@@ -45,6 +46,10 @@
|
|
|
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="10" , 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>
|
package/red-bacnet/read_point.js
CHANGED
|
@@ -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
|
-
|