Generic updates completed for now

This commit is contained in:
znetsixe
2025-07-01 15:24:18 +02:00
parent b4803e5e9b
commit edf9b09af1
4 changed files with 17 additions and 20 deletions

View File

@@ -7,14 +7,14 @@
const { outputUtils, configManager } = require('generalFunctions');
const Specific = require("./specificClass");
/**
* Class representing a Measurement Node-RED node.
*/
class nodeClass {
/**
* Create a MeasurementNode.
* @param {object} uiConfig - Node-RED node configuration.
* @param {object} RED - Node-RED runtime API.
* @param {object} nodeInstance - The Node-RED node instance.
* @param {string} nameOfNode - The name of the node, used for
*/
constructor(uiConfig, RED, nodeInstance, nameOfNode) {
@@ -48,7 +48,7 @@ class nodeClass {
// Merge UI config over defaults
this.config = {
general: {
name: this.name,
name: uiConfig.name,
id: node.id, // node.id is for the child registration process
unit: uiConfig.unit, // add converter options later to convert to default units (need like a model that defines this which units we are going to use and then conver to those standards)
logging: {
@@ -94,6 +94,7 @@ class nodeClass {
*/
_setupSpecificClass() {
this.source = new Specific(this.config);
this.node.source = this.source; // Store the source in the node instance for easy access
}
/**
@@ -114,7 +115,7 @@ class nodeClass {
this.node.send([
null,
null,
{ topic: 'registerChild', payload: this.config.general.id, positionVsParent: this.config?.functionality?.positionVsParent || 'atEquipment' },
{ topic: 'registerChild', payload: this.node.id , positionVsParent: this.config?.functionality?.positionVsParent || 'atEquipment' },
]);
}, 100);
}