diff --git a/src/nodeClass.js b/src/nodeClass.js index 071fefe..cc0f548 100644 --- a/src/nodeClass.js +++ b/src/nodeClass.js @@ -38,23 +38,14 @@ class nodeClass { _loadConfig(uiConfig, node) { const cfgMgr = new configManager(); this.defaultConfig = cfgMgr.getConfig(this.name); - const flowUnit = this._resolveUnitOrFallback(uiConfig.unit, 'volumeFlowRate', 'm3/h', 'flow'); - // Merge UI config over defaults - this.config = { - general: { - name: uiConfig.name, - id: node.id, // node.id is for the child registration process - unit: flowUnit, - logging: { - enabled: uiConfig.enableLog, - logLevel: uiConfig.logLevel, - }, - }, - functionality: { - positionVsParent: uiConfig.positionVsParent || "atEquipment", // Default to 'atEquipment' if not set - }, - }; + // Resolve flow unit with validation before building config + const flowUnit = this._resolveUnitOrFallback(uiConfig.unit, 'volumeFlowRate', 'm3/h', 'flow'); + const resolvedUiConfig = { ...uiConfig, unit: flowUnit }; + + // Build config: base sections (no domain-specific config for group controller) + this.config = cfgMgr.buildConfig(this.name, resolvedUiConfig, node.id); + // Utility for formatting outputs this._output = new outputUtils(); }