From d5db1ae0a0fc4c00c4fb71761e29c4bbe8f07734 Mon Sep 17 00:00:00 2001 From: "p.vanderwilt" Date: Wed, 16 Jul 2025 10:57:35 +0200 Subject: [PATCH] Added seperate process, DB and parent outputs --- advanced-reactor.html | 5 +++-- src/nodeClass.js | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/advanced-reactor.html b/advanced-reactor.html index 40ea4f6..91df690 100644 --- a/advanced-reactor.html +++ b/advanced-reactor.html @@ -26,8 +26,9 @@ X_TS_init: { value: 125.0009, required: true } }, inputs: 1, - outputs: 1, - outputLabels: "Effluent", + outputs: 3, + inputLabels: ["input"], + outputLabels: ["process", "dbase", "parent"], icon: "font-awesome/fa-recycle", label: function() { return this.name || "advanced-reactor"; diff --git a/src/nodeClass.js b/src/nodeClass.js index f4bbe25..9eba995 100644 --- a/src/nodeClass.js +++ b/src/nodeClass.js @@ -16,7 +16,7 @@ class nodeClass { this.name = nameOfNode; this._loadConfig(uiConfig) - + this._registerChild(); this._setupClass(); this._attachInputHandler(); @@ -60,7 +60,7 @@ class nodeClass { if (toggleUpdate) { this.reactor.updateState(msg.timestamp); - send(this.reactor.getEffluent); + send([this.reactor.getEffluent, null, null]); } if (done) { @@ -100,6 +100,20 @@ class nodeClass { } } + /** + * Register this node as a child upstream and downstream. + * Delayed to avoid Node-RED startup race conditions. + */ + _registerChild() { + setTimeout(() => { + this.node.send([ + null, + null, + { topic: 'registerChild', payload: this.node.id , positionVsParent: this.config?.functionality?.positionVsParent || 'atEquipment' }, + ]); + }, 100); + } + /** * Setup reactor class based on config */