iobroker.nexowatt-ui 0.7.30 → 0.7.32

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/ems/engine.js CHANGED
@@ -731,6 +731,7 @@ class EmsEngine {
731
731
  try { adapter.subscribeStates('thermal.*'); } catch (_e) {}
732
732
  try { adapter.subscribeStates('threshold.*'); } catch (_e) {}
733
733
  try { adapter.subscribeStates('gridConstraints.*'); } catch (_e) {}
734
+ try { adapter.subscribeStates('aiAdvisor.*'); } catch (_e) {}
734
735
 
735
736
  // Start scheduler
736
737
  if (this._timer) clearInterval(this._timer);
@@ -15,6 +15,7 @@ const { HeatingRodControlModule } = require('./modules/heating-rod-control');
15
15
  const { BhkwControlModule } = require('./modules/bhkw-control');
16
16
  const { GeneratorControlModule } = require('./modules/generator-control');
17
17
  const { ThresholdControlModule } = require('./modules/threshold-control');
18
+ const { AiAdvisorModule } = require('./modules/ai-advisor');
18
19
 
19
20
  class ModuleManager {
20
21
  /**
@@ -221,6 +222,14 @@ class ModuleManager {
221
222
  enabledFn: () => !!this.adapter.config.enableThresholdControl,
222
223
  });
223
224
 
225
+ // KI‑Energieberater / KI‑Optimierung (advisory only)
226
+ // Runs late in the tick so it can read the fresh budget/tariff/peak/storage snapshots.
227
+ this.modules.push({
228
+ key: 'aiAdvisor',
229
+ instance: new AiAdvisorModule(this.adapter, this.dp),
230
+ enabledFn: () => !!(this.adapter.config.enableAiAdvisor || this.adapter.config.enableAiOptimization),
231
+ });
232
+
224
233
  // Multi use (future)
225
234
  this.modules.push({
226
235
  key: 'multiUse',
@@ -231,7 +240,7 @@ class ModuleManager {
231
240
  // Init modules
232
241
  // Hinweis: Einige Module stellen UI-States bereit (z. B. EVCS), die auch dann
233
242
  // vorhanden sein sollen, wenn die Logik aktuell deaktiviert ist.
234
- const alwaysInit = new Set(['chargingManagement']);
243
+ const alwaysInit = new Set(['chargingManagement', 'aiAdvisor']);
235
244
  for (const m of this.modules) {
236
245
  const enabled = !!(m && typeof m.enabledFn === 'function' ? m.enabledFn() : false);
237
246
  m.enabled = enabled;
@@ -341,4 +350,4 @@ class ModuleManager {
341
350
 
342
351
  }
343
352
 
344
- module.exports = { ModuleManager };
353
+ module.exports = { ModuleManager };