@halsystems/red-bacnet 2.2.0-alpha.1 → 2.2.0-alpha2
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 +5 -0
- package/common/bacnet.js +6 -1
- package/common/job/discover_device.js +0 -3
- package/common/job/discover_point.js +0 -1
- package/common/job/read_point.js +0 -2
- package/common/job/write_point.js +4 -35
- package/package.json +1 -1
- package/red-bacnet/discover_point.html +1 -1
- package/red-bacnet/read_point.html +1 -1
- package/red-bacnet/write_point.html +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.2.0-alpha.2]
|
|
4
|
+
### Changed
|
|
5
|
+
- all `nodes` retained original `msg` properties
|
|
6
|
+
- `writePoint` emit `payload` with failed points after completion
|
|
7
|
+
|
|
3
8
|
## [2.2.0-alpha.1]
|
|
4
9
|
### Changed
|
|
5
10
|
- `ConcorrentTasksWithNetworkAwareness` added `invoke-id` generator and tracking
|
package/common/bacnet.js
CHANGED
|
@@ -402,7 +402,12 @@ module.exports = {
|
|
|
402
402
|
getNextInvokeId
|
|
403
403
|
);
|
|
404
404
|
} catch (err) {
|
|
405
|
-
eventEmitter.emit(EVENT_ERROR, {
|
|
405
|
+
eventEmitter.emit(EVENT_ERROR, {
|
|
406
|
+
point: {
|
|
407
|
+
[point.id]: point.value
|
|
408
|
+
},
|
|
409
|
+
error: getErrMsg(err)
|
|
410
|
+
});
|
|
406
411
|
}
|
|
407
412
|
return
|
|
408
413
|
}
|
package/common/job/read_point.js
CHANGED
|
@@ -20,6 +20,7 @@ const {
|
|
|
20
20
|
module.exports = {
|
|
21
21
|
WritePointJob: class WritePointJob extends BaseJob {
|
|
22
22
|
writePointDetails = {}
|
|
23
|
+
failedPoints = {}
|
|
23
24
|
devicePointSeparator = '.';
|
|
24
25
|
|
|
25
26
|
constructor(
|
|
@@ -176,14 +177,7 @@ module.exports = {
|
|
|
176
177
|
}
|
|
177
178
|
|
|
178
179
|
// add point details
|
|
179
|
-
pointDetails[id] = {
|
|
180
|
-
deviceName: p.deviceName,
|
|
181
|
-
bacType: p.bacType,
|
|
182
|
-
bacInstance: p.bacInstance,
|
|
183
|
-
bacProp: p.bacProp,
|
|
184
|
-
valueType: p.valueType,
|
|
185
|
-
priority: p.priority
|
|
186
|
-
}
|
|
180
|
+
pointDetails[id] = { ...p };
|
|
187
181
|
});
|
|
188
182
|
|
|
189
183
|
if (pointSchemaErrList.length > 0) {
|
|
@@ -307,6 +301,7 @@ module.exports = {
|
|
|
307
301
|
});
|
|
308
302
|
|
|
309
303
|
smartWriteEvent.on(EVENT_ERROR, (data) => {
|
|
304
|
+
Object.assign(this.failedPoints, data.point);
|
|
310
305
|
this.eventEmitter.emit(EVENT_ERROR, errMsg(
|
|
311
306
|
this.name, ERR_WRITING_POINT, data
|
|
312
307
|
));
|
|
@@ -319,34 +314,8 @@ module.exports = {
|
|
|
319
314
|
}
|
|
320
315
|
|
|
321
316
|
#exportWriteResults() {
|
|
322
|
-
// Separate successful and failed points
|
|
323
|
-
const failedPoints = {};
|
|
324
|
-
let totalPoints = 0;
|
|
325
|
-
let successfulPoints = 0;
|
|
326
|
-
|
|
327
|
-
Object.entries(this.writePointDetails).forEach(([key, value]) => {
|
|
328
|
-
totalPoints++;
|
|
329
|
-
// Check if point has an error property (would be set if write failed)
|
|
330
|
-
if (value.error) {
|
|
331
|
-
failedPoints[key] = value;
|
|
332
|
-
} else {
|
|
333
|
-
successfulPoints++;
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
|
|
337
317
|
// Update msg with results
|
|
338
|
-
this.msg.payload = failedPoints;
|
|
339
|
-
this.msg.result = {
|
|
340
|
-
written: successfulPoints,
|
|
341
|
-
failed: Object.keys(failedPoints).length,
|
|
342
|
-
total: totalPoints
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
// Remove input properties from msg
|
|
346
|
-
delete this.msg.devices;
|
|
347
|
-
delete this.msg.points;
|
|
348
|
-
delete this.msg.writePoints;
|
|
349
|
-
|
|
318
|
+
this.msg.payload = this.failedPoints;
|
|
350
319
|
this.eventEmitter.emit(EVENT_OUTPUT, this.msg);
|
|
351
320
|
}
|
|
352
321
|
}
|
package/package.json
CHANGED
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
<dt class="optional">msg.id <span class="property-type">string | number</span></dt>
|
|
96
96
|
<dd> Job ID. Default to <code>discoverPoints</code> if not provided.</dd>
|
|
97
97
|
<dt class="optional">msg.priority <span class="property-type">number</span></dt>
|
|
98
|
-
|
|
98
|
+
<dd> Job priority in queue. Default to <code>5</code> if not provided.</dd>
|
|
99
99
|
</dl>
|
|
100
100
|
|
|
101
101
|
<h3>Outputs</h3>
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
<dd> Job ID. Default to <code>readPoints</code> if not provided.</dd>
|
|
92
92
|
|
|
93
93
|
<dt class="optional">msg.priority <span class="property-type">number</span></dt>
|
|
94
|
-
<dd> Job priority in queue. Default to <code>
|
|
94
|
+
<dd> Job priority in queue. Default to <code>3</code> if not provided.</dd>
|
|
95
95
|
</dl>
|
|
96
96
|
|
|
97
97
|
<h3>Outputs</h3>
|
|
@@ -82,6 +82,12 @@
|
|
|
82
82
|
<dd> Job priority in queue. Default to <code>2</code> if not provided.</dd>
|
|
83
83
|
</dl>
|
|
84
84
|
|
|
85
|
+
<h3>Outputs</h3>
|
|
86
|
+
<dl class="message-properties">
|
|
87
|
+
<dt>msg.payload <span class="property-type">object</span></dt>
|
|
88
|
+
<dd>Failed to write points.</dd>
|
|
89
|
+
</dl>
|
|
90
|
+
|
|
85
91
|
<h3>Details</h3>
|
|
86
92
|
<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>
|
|
87
93
|
</script>
|