iobroker.nexowatt-ui 0.8.2 → 0.8.5

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.
@@ -2,7 +2,7 @@
2
2
  * AUTO-GENERATED RUNTIME FILE - NICHT MANUELL BEARBEITEN.
3
3
  *
4
4
  * Quelle: src-ts/runtime-executables/ems/module-manager.ts
5
- * Quell-Hash: sha256:d72c7e27d67f3cd0d1b9b7118ed95cb1031a1466077b200dd4ce34c63ff65295
5
+ * Quell-Hash: sha256:138e498ef2823e48e9bd755091453e05f6f30b5fc63aa8c8c7e9af3683d97126
6
6
  * Erzeugung: npm run sync:ts-runtime-executables
7
7
  *
8
8
  * Zweck:
@@ -112,6 +112,23 @@ class ModuleManager {
112
112
  * Zusammenhang: Teil von EMS-Kern: Engine, Module, Datenpunkte; Aufrufstellen und abhängige States/APIs beim Ändern mitprüfen.
113
113
  * TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
114
114
  */
115
+ _licenseEdition() {
116
+ const info = this.adapter && this.adapter._nwLicenseInfo && typeof this.adapter._nwLicenseInfo === 'object' ? this.adapter._nwLicenseInfo : {};
117
+ if (info && info.ok === true) {
118
+ const e = String(info.edition || 'eos').toLowerCase();
119
+ return e === 'hems' ? 'hems' : 'eos';
120
+ }
121
+ return 'none';
122
+ }
123
+
124
+ _licenseAllowsApp(appId) {
125
+ const edition = this._licenseEdition();
126
+ if (edition === 'eos') return true;
127
+ if (edition !== 'hems') return false;
128
+ const hemsApps = new Set(['charging', 'storage', 'thermal', 'heatingrod', 'threshold', 'relay', 'aiAdvisor', 'tariff', 'para14a']);
129
+ return hemsApps.has(String(appId || ''));
130
+ }
131
+
115
132
  _getDiagCfg() {
116
133
  const cfg = (this.adapter && this.adapter.config && this.adapter.config.diagnostics) ? this.adapter.config.diagnostics : null;
117
134
  const enabled = !!(cfg && cfg.enabled);
@@ -206,14 +223,14 @@ class ModuleManager {
206
223
  this.modules.push({
207
224
  key: 'gridConstraints',
208
225
  instance: new GridConstraintsModule(this.adapter, this.dp),
209
- enabledFn: () => !!this.adapter.config.enableGridConstraints,
226
+ enabledFn: () => this._licenseAllowsApp('grid') && !!this.adapter.config.enableGridConstraints,
210
227
  });
211
228
 
212
229
  // Peak shaving
213
230
  this.modules.push({
214
231
  key: 'peakShaving',
215
232
  instance: new PeakShavingModule(this.adapter, this.dp),
216
- enabledFn: () => !!this.adapter.config.enablePeakShaving || !!(this.adapter.config.peakShaving && this.adapter.config.peakShaving.atypical && this.adapter.config.peakShaving.atypical.enabled),
233
+ enabledFn: () => this._licenseAllowsApp('peak') && (!!this.adapter.config.enablePeakShaving || !!(this.adapter.config.peakShaving && this.adapter.config.peakShaving.atypical && this.adapter.config.peakShaving.atypical.enabled)),
217
234
  });
218
235
 
219
236
  // §14a EnWG (steuerbare Verbrauchseinrichtungen)
@@ -221,7 +238,7 @@ class ModuleManager {
221
238
  this.modules.push({
222
239
  key: 'para14a',
223
240
  instance: new Para14aModule(this.adapter, this.dp),
224
- enabledFn: () => !!(this.adapter?.config?.installerConfig?.para14a),
241
+ enabledFn: () => this._licenseAllowsApp('para14a') && !!(this.adapter?.config?.installerConfig?.para14a),
225
242
  });
226
243
 
227
244
  // Tarif (VIS) – stellt Ladepark-Deckel bereit
@@ -251,6 +268,7 @@ class ModuleManager {
251
268
  key: 'chargingManagement',
252
269
  instance: new ChargingManagementModule(this.adapter, this.dp),
253
270
  enabledFn: () => {
271
+ if (!this._licenseAllowsApp('charging')) return false;
254
272
  // Backwards compatible default:
255
273
  // Older installations may not have the new EMS config persisted yet.
256
274
  // If the flag is missing (undefined/null), we enable the module so the
@@ -283,7 +301,7 @@ class ModuleManager {
283
301
  // das Modul nicht explizit aktiviert hat, der Endkunde aber den dynamischen Tarif
284
302
  // (VIS) nutzt. Die eigentliche Schreiblogik entscheidet im Modul selbst, ob
285
303
  // tatsächlich Setpoints geschrieben werden (Failsafe).
286
- enabledFn: () => true,
304
+ enabledFn: () => this._licenseAllowsApp('storage'),
287
305
  });
288
306
 
289
307
  // Thermische Steuerung (Wärmepumpe/Klima)
@@ -292,7 +310,7 @@ class ModuleManager {
292
310
  this.modules.push({
293
311
  key: 'thermalControl',
294
312
  instance: new ThermalControlModule(this.adapter, this.dp),
295
- enabledFn: () => !!this.adapter.config.enableThermalControl,
313
+ enabledFn: () => this._licenseAllowsApp('thermal') && !!this.adapter.config.enableThermalControl,
296
314
  });
297
315
 
298
316
  // Gestufte Heizstäbe (native 1..12 Stufen)
@@ -301,20 +319,20 @@ class ModuleManager {
301
319
  this.modules.push({
302
320
  key: 'heatingRodControl',
303
321
  instance: new HeatingRodControlModule(this.adapter, this.dp),
304
- enabledFn: () => !!this.adapter.config.enableHeatingRodControl,
322
+ enabledFn: () => this._licenseAllowsApp('heatingrod') && !!this.adapter.config.enableHeatingRodControl,
305
323
  });
306
324
 
307
325
  // BHKW Steuerung (Start/Stop, SoC-geführt)
308
326
  this.modules.push({
309
327
  key: 'bhkwControl',
310
328
  instance: new BhkwControlModule(this.adapter, this.dp),
311
- enabledFn: () => !!this.adapter.config.enableBhkwControl,
329
+ enabledFn: () => this._licenseAllowsApp('bhkw') && !!this.adapter.config.enableBhkwControl,
312
330
  });
313
331
 
314
332
  this.modules.push({
315
333
  key: 'generatorControl',
316
334
  instance: new GeneratorControlModule(this.adapter, this.dp),
317
- enabledFn: () => !!this.adapter.config.enableGeneratorControl,
335
+ enabledFn: () => this._licenseAllowsApp('generator') && !!this.adapter.config.enableGeneratorControl,
318
336
  });
319
337
 
320
338
  // Schwellwertsteuerung (generische Regeln)
@@ -322,7 +340,7 @@ class ModuleManager {
322
340
  this.modules.push({
323
341
  key: 'thresholdControl',
324
342
  instance: new ThresholdControlModule(this.adapter, this.dp),
325
- enabledFn: () => !!this.adapter.config.enableThresholdControl,
343
+ enabledFn: () => this._licenseAllowsApp('threshold') && !!this.adapter.config.enableThresholdControl,
326
344
  });
327
345
 
328
346
  // KI‑Energieberater / KI‑Optimierung (advisory only)
@@ -330,14 +348,14 @@ class ModuleManager {
330
348
  this.modules.push({
331
349
  key: 'aiAdvisor',
332
350
  instance: new AiAdvisorModule(this.adapter, this.dp),
333
- enabledFn: () => !!(this.adapter.config.enableAiAdvisor || this.adapter.config.enableAiOptimization),
351
+ enabledFn: () => this._licenseAllowsApp('aiAdvisor') && !!(this.adapter.config.enableAiAdvisor || this.adapter.config.enableAiOptimization),
334
352
  });
335
353
 
336
354
  // Multi use (future)
337
355
  this.modules.push({
338
356
  key: 'multiUse',
339
357
  instance: new MultiUseModule(this.adapter, this.dp),
340
- enabledFn: () => !!this.adapter.config.enableMultiUse,
358
+ enabledFn: () => this._licenseAllowsApp('multiuse') && !!this.adapter.config.enableMultiUse,
341
359
  });
342
360
 
343
361
  // Init modules
package/io-package.json CHANGED
@@ -1,8 +1,20 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "nexowatt-ui",
4
- "version": "0.8.2",
4
+ "version": "0.8.5",
5
5
  "news": {
6
+ "0.8.5": {
7
+ "de": "Version 0.8.5: Windows-Publish-Hotfix. Die automatische DevDependency-Installation nutzt nun npm-cli.js/cmd.exe-Fallback statt direktem npm.cmd-Spawn und verhindert EINVAL-Abbrüche beim npm publish.",
8
+ "en": "Version 0.8.5: Windows publish hotfix. Automatic devDependency installation now uses npm-cli.js/cmd.exe fallback instead of direct npm.cmd spawning and prevents EINVAL aborts during npm publish."
9
+ },
10
+ "0.8.4": {
11
+ "de": "Version 0.8.4: Release-Cleanup gegen Merge-Konfliktmarker und npm-Publish-Abbrueche. Service-Worker-Cache aktualisiert; EOS/HEMS-Lizenzmodell und App-Center-Cleanup bleiben unveraendert.",
12
+ "en": "Version 0.8.4: Release cleanup against merge conflict markers and npm publish aborts. Service worker cache updated; EOS/HEMS license model and App Center cleanup remain unchanged."
13
+ },
14
+ "0.8.3": {
15
+ "de": "Version 0.8.3: App-Center bereinigt die sichtbaren TypeScript-Migrationsdiagnosen. Neues Lizenzmodell mit EOS als Vollprodukt und HEMS als kleiner Edition; HEMS erhält die freigegebenen Basis-/Steuerfunktionen inklusive Lademanagement bis 3 Wallboxen, EOS erhält Vollzugriff.",
16
+ "en": "Version 0.8.3: The App Center hides the visible TypeScript migration diagnostics. New license model with EOS as the full product and HEMS as the smaller edition; HEMS receives the approved base/control features including charging management up to 3 wallboxes, EOS receives full access."
17
+ },
6
18
  "0.8.2": {
7
19
  "de": "Version 0.8.2: Windows-sicherer npm-Publish-Check. Der TypeScript-Compiler wird vor Publish-Checks robust aufgelöst oder DevDependencies werden automatisch nachinstalliert; App-Center-Statusfarben aus 0.8.1 bleiben erhalten.",
8
20
  "en": "Version 0.8.2: Windows-safe npm publish check. The TypeScript compiler is resolved robustly before publish checks or devDependencies are installed automatically; App Center status colors from 0.8.1 remain in place."
@@ -18,18 +30,6 @@
18
30
  "0.7.132": {
19
31
  "de": "TypeScript-Runtime-Cleanup: nicht mehr genutzter .nwcore-JS-Doppelbaum und stale build-ts-Artefakte entfernt; EMS/main/www bleiben generierte Runtime-JS-Artefakte aus src-ts/runtime-executables, EVCS bleibt TS-Normalquelle mit JS nur als Executor/Hard-Fallback.",
20
32
  "en": "TypeScript runtime cleanup: removed the unused .nwcore JS duplicate tree and stale build-ts artifacts; EMS/main/www remain generated runtime JS artifacts from src-ts/runtime-executables, EVCS remains the TS normal source with JS only as executor/hard fallback."
21
- },
22
- "0.7.131": {
23
- "de": "Adapterweite TypeScript-Runtime-Quelle aktiviert: main.js, EMS-/NwCore-Module und www-Runtime-Dateien sind jetzt generierte JavaScript-Artefakte aus src-ts/runtime-executables; EVCS bleibt TS-Normalquelle mit JS nur als ioBroker-Executor/Hard-Fallback.",
24
- "en": "Adapter-wide TypeScript runtime source enabled: main.js, EMS/NwCore modules and www runtime files are now generated JavaScript artifacts from src-ts/runtime-executables; EVCS remains the TS normal source with JS only as ioBroker executor/hard fallback."
25
- },
26
- "0.7.130": {
27
- "de": "EVCS-TypeScript-Normalquelle aktiviert: Allocation und kompletter EVCS-Handover laufen im grünen Gate als TS-Normalpfad; JS bleibt nur ioBroker-Executor und harter Fallback. App-Center/API zeigen Normalquellen-Lockdown und Migrationsbereitschaft.",
28
- "en": "EVCS TypeScript normal source enabled: allocation and the complete EVCS handover run through the green TS normal-path gate; JS remains only the ioBroker executor and hard fallback. App Center/API expose normal-source lockdown and migration readiness."
29
- },
30
- "0.7.129": {
31
- "en": "EVCS TypeScript handover hardened: safety stop/ramp-down paths can now use the productive TS Allocation + Write-Plan zero-setpoint contract; JavaScript remains executor and hard fallback only.",
32
- "de": "EVCS-TypeScript-Handover gehärtet: Safety-Stop/Rampdown-Zweige können jetzt den produktiven TS-Allocation- und Write-Plan-0-Setpoint-Vertrag nutzen; JavaScript bleibt nur Executor und harter Fallback."
33
33
  }
34
34
  },
35
35
  "title": "NexoWatt UI",
package/main.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * AUTO-GENERATED RUNTIME FILE - NICHT MANUELL BEARBEITEN.
3
3
  *
4
4
  * Quelle: src-ts/runtime-executables/main.ts
5
- * Quell-Hash: sha256:34d0a5a1992d3c4d5680d94611faf3d4c449949e59a84c6b7b4c1284626b2dc9
5
+ * Quell-Hash: sha256:af66e1112fcefe3ed68f3321f130b88ef485a297e5a5c46142ea6bd4408f2460
6
6
  * Erzeugung: npm run sync:ts-runtime-executables
7
7
  *
8
8
  * Zweck:
@@ -1736,6 +1736,9 @@ class NexoWattVis extends utils.Adapter {
1736
1736
  uuid: { type: 'string', role: 'text', def: '' },
1737
1737
  valid: { type: 'boolean', role: 'state', def: false },
1738
1738
  type: { type: 'string', role: 'text', def: 'none' },
1739
+ edition: { type: 'string', role: 'text', def: 'none' },
1740
+ featuresJson: { type: 'string', role: 'json', def: '{}' },
1741
+ maxWallboxes: { type: 'number', role: 'value', def: 0 },
1739
1742
  message: { type: 'string', role: 'text', def: '' },
1740
1743
  expiresAt: { type: 'number', role: 'value.time', def: 0 },
1741
1744
  daysRemaining: { type: 'number', role: 'value', def: 0 },
@@ -1960,6 +1963,216 @@ class NexoWattVis extends utils.Adapter {
1960
1963
  const groups = core.match(/.{1,4}/g) || [core];
1961
1964
  return `NW1-${groups.join('-')}`;
1962
1965
  }
1966
+
1967
+ /**
1968
+ * Lizenz-Editionen ab 0.8.3:
1969
+ * - EOS ist das große Vollprodukt und erhält alle aktuellen und künftigen Features.
1970
+ * - HEMS ist die kleinere Edition mit explizit freigegebenen Basis-/Steuerfunktionen.
1971
+ * Alte gültige NW1-/NW1T-Schlüssel ohne Edition werden aus Kompatibilitätsgründen als EOS behandelt.
1972
+ */
1973
+ _nwNormalizeLicenseEdition(edition) {
1974
+ const e = String(edition || '').trim().toLowerCase();
1975
+ if (e === 'eos') return 'eos';
1976
+ if (e === 'hems') return 'hems';
1977
+ return 'none';
1978
+ }
1979
+
1980
+ _nwLicenseSecret() {
1981
+ return 'nw_lis_salt_v1 change me';
1982
+ }
1983
+
1984
+ _nwExpectedEditionLicenseKey(uuid, edition) {
1985
+ const u = String(uuid || '').trim();
1986
+ const ed = this._nwNormalizeLicenseEdition(edition);
1987
+ if (!u || !['eos', 'hems'].includes(ed)) return '';
1988
+ const prefix = ed === 'hems' ? 'NW1H' : 'NW1E';
1989
+ const msg = `${u}|${ed.toUpperCase()}|FULL`;
1990
+ const hex = crypto.createHmac('sha256', this._nwLicenseSecret()).update(msg).digest('hex').toUpperCase();
1991
+ const groups = hex.slice(0, 32).match(/.{1,4}/g) || [hex.slice(0, 32)];
1992
+ return `${prefix}-${groups.join('-')}`;
1993
+ }
1994
+
1995
+ _nwResolveFullLicense(uuid, enteredKey) {
1996
+ const n = this._nwNormalizeLicenseKey(enteredKey);
1997
+ if (!n) return null;
1998
+
1999
+ // Legacy full key: keep all existing customers on the large EOS edition.
2000
+ const legacy = this._nwExpectedLicenseKey(uuid);
2001
+ if (legacy && this._nwNormalizeLicenseKey(legacy) === n) {
2002
+ return { ok: true, type: 'full', edition: 'eos', legacy: true };
2003
+ }
2004
+
2005
+ const candidates = [
2006
+ { edition: 'eos', expected: this._nwExpectedEditionLicenseKey(uuid, 'eos') },
2007
+ { edition: 'hems', expected: this._nwExpectedEditionLicenseKey(uuid, 'hems') },
2008
+ ];
2009
+ for (const c of candidates) {
2010
+ if (c.expected && this._nwNormalizeLicenseKey(c.expected) === n) {
2011
+ return { ok: true, type: 'full', edition: c.edition, legacy: false };
2012
+ }
2013
+ }
2014
+ return null;
2015
+ }
2016
+
2017
+ _nwExpectedEditionTrialSig(uuid, daysStr, edition) {
2018
+ const u = String(uuid || '').trim();
2019
+ const ds = String(daysStr || '').trim();
2020
+ const ed = this._nwNormalizeLicenseEdition(edition);
2021
+ if (!u || !/^\d{3}$/.test(ds) || !['eos', 'hems'].includes(ed)) return '';
2022
+ const msg = `${u}|${ed.toUpperCase()}|TRIAL|${ds}`;
2023
+ const hex = crypto.createHmac('sha256', this._nwLicenseSecret()).update(msg).digest('hex').toUpperCase();
2024
+ return hex.slice(0, 32);
2025
+ }
2026
+
2027
+ _nwExpectedEditionTrialKey(uuid, daysStr, edition) {
2028
+ const ed = this._nwNormalizeLicenseEdition(edition);
2029
+ const sig = this._nwExpectedEditionTrialSig(uuid, daysStr, ed);
2030
+ if (!sig) return '';
2031
+ const prefix = ed === 'hems' ? 'NW1TH' : 'NW1TE';
2032
+ const groups = sig.match(/.{1,4}/g) || [sig];
2033
+ return `${prefix}-${String(daysStr || '').trim()}-${groups.join('-')}`;
2034
+ }
2035
+
2036
+ _nwCurrentLicenseEdition() {
2037
+ const info = (this._nwLicenseInfo && typeof this._nwLicenseInfo === 'object') ? this._nwLicenseInfo : {};
2038
+ if (info.ok === true) return this._nwNormalizeLicenseEdition(info.edition || (info.type === 'full' || info.type === 'trial' ? 'eos' : 'none'));
2039
+ return 'none';
2040
+ }
2041
+
2042
+ _nwLicenseFeaturesForEdition(edition) {
2043
+ const ed = this._nwNormalizeLicenseEdition(edition);
2044
+ const hemsFeatures = new Set([
2045
+ 'dashboard',
2046
+ 'history',
2047
+ 'aiAdvisor',
2048
+ 'smartHome',
2049
+ 'dynamicTariffs',
2050
+ 'tariff',
2051
+ 'chargingManagement',
2052
+ 'storageControl',
2053
+ 'thermalControl',
2054
+ 'heatingRodControl',
2055
+ 'relayControl',
2056
+ 'para14a',
2057
+ 'thresholdControl',
2058
+ 'energyFlow',
2059
+ 'pvForecast'
2060
+ ]);
2061
+ const eosOnlyFeatures = [
2062
+ 'peakShaving',
2063
+ 'storageFarm',
2064
+ 'multiUse',
2065
+ 'gridLimits',
2066
+ 'gridConstraints',
2067
+ 'generatorControl',
2068
+ 'bhkwControl',
2069
+ 'advancedChargingPark',
2070
+ 'advancedDiagnostics'
2071
+ ];
2072
+ const all = new Set([...hemsFeatures, ...eosOnlyFeatures]);
2073
+ const out = {};
2074
+ for (const f of all) out[f] = ed === 'eos' ? true : (ed === 'hems' ? hemsFeatures.has(f) : false);
2075
+ return out;
2076
+ }
2077
+
2078
+ _nwLicenseAppFeature(appId) {
2079
+ const map = {
2080
+ charging: 'chargingManagement',
2081
+ peak: 'peakShaving',
2082
+ storage: 'storageControl',
2083
+ storagefarm: 'storageFarm',
2084
+ thermal: 'thermalControl',
2085
+ heatingrod: 'heatingRodControl',
2086
+ bhkw: 'bhkwControl',
2087
+ generator: 'generatorControl',
2088
+ threshold: 'thresholdControl',
2089
+ relay: 'relayControl',
2090
+ grid: 'gridConstraints',
2091
+ aiAdvisor: 'aiAdvisor',
2092
+ tariff: 'dynamicTariffs',
2093
+ para14a: 'para14a',
2094
+ multiuse: 'multiUse'
2095
+ };
2096
+ return map[String(appId || '')] || String(appId || '');
2097
+ }
2098
+
2099
+ _nwIsFeatureLicensed(feature) {
2100
+ const edition = this._nwCurrentLicenseEdition();
2101
+ if (edition === 'eos') return true;
2102
+ const features = this._nwLicenseFeaturesForEdition(edition);
2103
+ return !!features[String(feature || '')];
2104
+ }
2105
+
2106
+ _nwLicenseAllowsAppId(appId) {
2107
+ return this._nwIsFeatureLicensed(this._nwLicenseAppFeature(appId));
2108
+ }
2109
+
2110
+ _nwLicenseMaxWallboxes() {
2111
+ const edition = this._nwCurrentLicenseEdition();
2112
+ if (edition === 'hems') return 3;
2113
+ if (edition === 'eos') return 0; // 0 = unbegrenzt / Systemlimit
2114
+ return 0;
2115
+ }
2116
+
2117
+ _nwBuildLicenseFeatureInfo() {
2118
+ const info = (this._nwLicenseInfo && typeof this._nwLicenseInfo === 'object') ? this._nwLicenseInfo : {};
2119
+ const edition = this._nwCurrentLicenseEdition();
2120
+ const features = this._nwLicenseFeaturesForEdition(edition);
2121
+ return {
2122
+ valid: !!this._nwLicenseOk,
2123
+ type: String(info.type || 'none'),
2124
+ edition,
2125
+ editionLabel: edition === 'eos' ? 'EOS' : (edition === 'hems' ? 'HEMS' : 'Keine Lizenz'),
2126
+ message: String(info.msg || ''),
2127
+ expiresAt: Number(info.expiresAt || 0),
2128
+ daysRemaining: Number(info.daysRemaining || 0),
2129
+ maxWallboxes: this._nwLicenseMaxWallboxes(),
2130
+ features,
2131
+ hemsIncludedApps: ['charging', 'storage', 'thermal', 'heatingrod', 'threshold', 'relay', 'aiAdvisor', 'tariff', 'para14a'],
2132
+ eosFullAccess: edition === 'eos'
2133
+ };
2134
+ }
2135
+
2136
+ _nwApplyLicenseLimitsToEmsApps(emsApps) {
2137
+ const out = (emsApps && typeof emsApps === 'object') ? this.nwDeepMerge ? this.nwDeepMerge({}, emsApps) : JSON.parse(JSON.stringify(emsApps)) : { schemaVersion: 1, apps: {} };
2138
+ out.schemaVersion = out.schemaVersion || 1;
2139
+ out.apps = (out.apps && typeof out.apps === 'object') ? out.apps : {};
2140
+ for (const appId of Object.keys(out.apps)) {
2141
+ if (!this._nwLicenseAllowsAppId(appId)) {
2142
+ out.apps[appId] = Object.assign({}, out.apps[appId] || {}, { installed: false, enabled: false, licenseBlocked: true, requiredLicense: 'EOS' });
2143
+ } else {
2144
+ out.apps[appId] = Object.assign({}, out.apps[appId] || {}, { licenseBlocked: false, requiredLicense: this._nwCurrentLicenseEdition() === 'hems' ? 'HEMS' : 'EOS' });
2145
+ }
2146
+ }
2147
+ return out;
2148
+ }
2149
+
2150
+ _nwApplyLicenseLimitsToInstallerPatch(patch) {
2151
+ const p = (patch && typeof patch === 'object') ? patch : {};
2152
+ try {
2153
+ if (p.emsApps && typeof p.emsApps === 'object') {
2154
+ p.emsApps = this._nwApplyLicenseLimitsToEmsApps(p.emsApps);
2155
+ }
2156
+ } catch (_e) {}
2157
+ try {
2158
+ const maxWb = this._nwLicenseMaxWallboxes();
2159
+ if (maxWb > 0 && p.settingsConfig && typeof p.settingsConfig === 'object') {
2160
+ const rawCount = Number(p.settingsConfig.evcsCount);
2161
+ const count = Number.isFinite(rawCount) ? Math.max(0, Math.min(maxWb, Math.round(rawCount))) : 0;
2162
+ p.settingsConfig.evcsCount = count;
2163
+ if (Array.isArray(p.settingsConfig.evcsList)) p.settingsConfig.evcsList = p.settingsConfig.evcsList.slice(0, count);
2164
+ if (Array.isArray(p.settingsConfig.stationGroups)) {
2165
+ p.settingsConfig.stationGroups = p.settingsConfig.stationGroups.map((g) => {
2166
+ const row = (g && typeof g === 'object') ? Object.assign({}, g) : {};
2167
+ if (Array.isArray(row.members)) row.members = row.members.filter((x) => Number(x) >= 1 && Number(x) <= count);
2168
+ if (Array.isArray(row.connectors)) row.connectors = row.connectors.filter((x) => Number(x) >= 1 && Number(x) <= count);
2169
+ return row;
2170
+ });
2171
+ }
2172
+ }
2173
+ } catch (_e) {}
2174
+ return p;
2175
+ }
1963
2176
  /**
1964
2177
  * Code-Teil: _nwExpectedTrialSig
1965
2178
  * Zweck: Kapselt einen lokalen Verarbeitungsschritt, damit Aufrufer nicht direkt in Detaildaten eingreifen.
@@ -2001,13 +2214,16 @@ class NexoWattVis extends utils.Adapter {
2001
2214
  */
2002
2215
  _nwParseTrialKey(enteredKey) {
2003
2216
  const n = this._nwNormalizeLicenseKey(enteredKey);
2004
- const m = n.match(/^NW1T(\d{3})([0-9A-F]{32})$/);
2217
+ const m = n.match(/^NW1T(E|H)?(\d{3})([0-9A-F]{32})$/);
2005
2218
  if (!m) return null;
2006
- const daysStr = m[1];
2007
- const sig = m[2];
2219
+ const editionToken = m[1] || '';
2220
+ const daysStr = m[2];
2221
+ const sig = m[3];
2008
2222
  const days = parseInt(daysStr, 10);
2009
2223
  if (!days || days < 1) return null;
2010
- return { daysStr, days, sig };
2224
+ const edition = editionToken === 'H' ? 'hems' : 'eos';
2225
+ const legacy = !editionToken;
2226
+ return { daysStr, days, sig, edition, legacy };
2011
2227
  }
2012
2228
  /**
2013
2229
  * Code-Teil: _nwIsLicenseValid
@@ -2016,10 +2232,7 @@ class NexoWattVis extends utils.Adapter {
2016
2232
  * TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
2017
2233
  */
2018
2234
  _nwIsLicenseValid(uuid, enteredKey) {
2019
- // Voll-Lizenz
2020
- const expected = this._nwExpectedLicenseKey(uuid);
2021
- if (!expected) return false;
2022
- return this._nwNormalizeLicenseKey(expected) === this._nwNormalizeLicenseKey(enteredKey);
2235
+ return !!this._nwResolveFullLicense(uuid, enteredKey);
2023
2236
  }
2024
2237
  /**
2025
2238
  * Code-Teil: _nwClearTrialState
@@ -2041,14 +2254,16 @@ class NexoWattVis extends utils.Adapter {
2041
2254
  */
2042
2255
  async _nwCheckTrialLicense(uuid, enteredKey) {
2043
2256
  const u = String(uuid || '').trim();
2044
- if (!u) return { ok: false, type: 'invalid', msg: 'UUID nicht verfügbar' };
2257
+ if (!u) return { ok: false, type: 'invalid', edition: 'none', msg: 'UUID nicht verfügbar' };
2045
2258
 
2046
2259
  const parsed = this._nwParseTrialKey(enteredKey);
2047
2260
  if (!parsed) return { ok: false, type: 'invalid', msg: 'Kein Testschlüssel erkannt' };
2048
2261
 
2049
- const expectedSig = this._nwExpectedTrialSig(u, parsed.daysStr);
2262
+ const expectedSig = parsed.legacy
2263
+ ? this._nwExpectedTrialSig(u, parsed.daysStr)
2264
+ : this._nwExpectedEditionTrialSig(u, parsed.daysStr, parsed.edition);
2050
2265
  if (!expectedSig || expectedSig !== parsed.sig) {
2051
- return { ok: false, type: 'invalid', msg: 'Testschlüssel ungültig' };
2266
+ return { ok: false, type: 'invalid', edition: 'none', msg: 'Testschlüssel ungültig' };
2052
2267
  }
2053
2268
 
2054
2269
  const dayMs = 24 * 60 * 60 * 1000;
@@ -2094,7 +2309,8 @@ class NexoWattVis extends utils.Adapter {
2094
2309
  return {
2095
2310
  ok: true,
2096
2311
  type: 'trial',
2097
- msg: `Testlizenz aktiv – noch ${daysRemaining} Tag${daysRemaining === 1 ? '' : 'e'}`,
2312
+ edition: parsed.edition || 'eos',
2313
+ msg: `${(parsed.edition || 'eos').toUpperCase()} Testlizenz aktiv – noch ${daysRemaining} Tag${daysRemaining === 1 ? '' : 'e'}`,
2098
2314
  expiresAt,
2099
2315
  daysRemaining,
2100
2316
  };
@@ -2103,7 +2319,8 @@ class NexoWattVis extends utils.Adapter {
2103
2319
  return {
2104
2320
  ok: false,
2105
2321
  type: 'trial',
2106
- msg: 'Testlizenz abgelaufen',
2322
+ edition: parsed.edition || 'eos',
2323
+ msg: `${(parsed.edition || 'eos').toUpperCase()} Testlizenz abgelaufen`,
2107
2324
  expiresAt,
2108
2325
  daysRemaining: 0,
2109
2326
  };
@@ -2119,12 +2336,13 @@ class NexoWattVis extends utils.Adapter {
2119
2336
  if (!u) return { ok: false, type: 'invalid', msg: 'UUID nicht verfügbar' };
2120
2337
 
2121
2338
  const k = String(enteredKey || '').trim();
2122
- if (!k) return { ok: false, type: 'none', msg: 'Kein Lizenzschlüssel eingetragen' };
2339
+ if (!k) return { ok: false, type: 'none', edition: 'none', msg: 'Kein Lizenzschlüssel eingetragen' };
2123
2340
 
2124
- // 1) Voll-Lizenz
2125
- if (this._nwIsLicenseValid(u, k)) {
2341
+ // 1) Voll-Lizenz (Legacy NW1 = EOS; neue NW1E/NW1H enthalten die Edition)
2342
+ const full = this._nwResolveFullLicense(u, k);
2343
+ if (full && full.ok) {
2126
2344
  await this._nwClearTrialState();
2127
- return { ok: true, type: 'full', msg: 'Lizenz gültig' };
2345
+ return { ok: true, type: 'full', edition: full.edition || 'eos', legacy: !!full.legacy, msg: `${String(full.edition || 'eos').toUpperCase()} Lizenz gültig` };
2128
2346
  }
2129
2347
 
2130
2348
  // 2) Test-Lizenz
@@ -2133,7 +2351,7 @@ class NexoWattVis extends utils.Adapter {
2133
2351
  }
2134
2352
 
2135
2353
  // 3) Ungültig
2136
- return { ok: false, type: 'invalid', msg: 'Lizenz ungültig' };
2354
+ return { ok: false, type: 'invalid', edition: 'none', msg: 'Lizenz ungültig' };
2137
2355
  }
2138
2356
  /**
2139
2357
  * Code-Teil: _nwInitLicense
@@ -2151,6 +2369,7 @@ class NexoWattVis extends utils.Adapter {
2151
2369
  info = {
2152
2370
  ok: false,
2153
2371
  type: 'invalid',
2372
+ edition: 'none',
2154
2373
  msg: 'Lizenzschlüssel ist nur als geschützter Platzhalter gespeichert. Bitte echten Lizenzschlüssel neu eintragen.',
2155
2374
  };
2156
2375
  }
@@ -2160,7 +2379,11 @@ class NexoWattVis extends utils.Adapter {
2160
2379
  // Publish license status (useful for Admin UI)
2161
2380
  try { await this.setStateAsync('license.uuid', { val: this._nwSystemUuid, ack: true }); } catch (_e) {}
2162
2381
  try { await this.setStateAsync('license.valid', { val: this._nwLicenseOk, ack: true }); } catch (_e) {}
2382
+ const licenseFeatures = this._nwBuildLicenseFeatureInfo();
2163
2383
  try { await this.setStateAsync('license.type', { val: info.type || 'none', ack: true }); } catch (_e) {}
2384
+ try { await this.setStateAsync('license.edition', { val: licenseFeatures.edition || 'none', ack: true }); } catch (_e) {}
2385
+ try { await this.setStateAsync('license.featuresJson', { val: JSON.stringify(licenseFeatures), ack: true }); } catch (_e) {}
2386
+ try { await this.setStateAsync('license.maxWallboxes', { val: Number(licenseFeatures.maxWallboxes || 0), ack: true }); } catch (_e) {}
2164
2387
  try { await this.setStateAsync('license.message', { val: info.msg || '', ack: true }); } catch (_e) {}
2165
2388
  try { await this.setStateAsync('license.expiresAt', { val: info.expiresAt || 0, ack: true }); } catch (_e) {}
2166
2389
  try { await this.setStateAsync('license.daysRemaining', { val: info.daysRemaining || 0, ack: true }); } catch (_e) {}
@@ -2169,7 +2392,7 @@ class NexoWattVis extends utils.Adapter {
2169
2392
  if (info.type === 'trial') {
2170
2393
  this.log.info(`License valid (test license, ${info.daysRemaining} days remaining).`);
2171
2394
  } else {
2172
- this.log.info('License valid.');
2395
+ this.log.info(`License valid (${String(licenseFeatures.editionLabel || licenseFeatures.edition || 'Lizenz')}).`);
2173
2396
  }
2174
2397
  } else {
2175
2398
  // Keep message short; details are in Admin license tab.
@@ -3437,7 +3660,7 @@ class NexoWattVis extends utils.Adapter {
3437
3660
  if (base.groups && typeof base.groups === 'object') out.groups = base.groups;
3438
3661
  if (base.meta && typeof base.meta === 'object') out.meta = base.meta;
3439
3662
 
3440
- return out;
3663
+ try { return this._nwApplyLicenseLimitsToEmsApps(out); } catch (_e) { return out; }
3441
3664
  }
3442
3665
 
3443
3666
 
@@ -3478,14 +3701,14 @@ class NexoWattVis extends utils.Adapter {
3478
3701
 
3479
3702
  for (const a of CATALOG) {
3480
3703
  const st = (apps.apps && apps.apps[a.id]) ? apps.apps[a.id] : null;
3481
- n[a.enableFlag] = !!(st && st.installed && st.enabled);
3704
+ n[a.enableFlag] = this._nwLicenseAllowsAppId(a.id) && !!(st && st.installed && st.enabled);
3482
3705
  }
3483
3706
 
3484
3707
  // §14a is controlled via installerConfig.para14a
3485
3708
  try {
3486
3709
  const p = (apps.apps && apps.apps.para14a) ? apps.apps.para14a : null;
3487
3710
  n.installerConfig = (n.installerConfig && typeof n.installerConfig === 'object') ? n.installerConfig : {};
3488
- n.installerConfig.para14a = !!(p && p.installed && p.enabled);
3711
+ n.installerConfig.para14a = this._nwLicenseAllowsAppId('para14a') && !!(p && p.installed && p.enabled);
3489
3712
  } catch (_e) {
3490
3713
  // ignore
3491
3714
  }
@@ -3497,6 +3720,8 @@ class NexoWattVis extends utils.Adapter {
3497
3720
  // ignore
3498
3721
  }
3499
3722
 
3723
+ try { n.emsApps = this._nwApplyLicenseLimitsToEmsApps(apps); } catch (_e) {}
3724
+
3500
3725
  return n;
3501
3726
  }
3502
3727
 
@@ -6262,7 +6487,9 @@ try {
6262
6487
  const rawCount = (cfg.evcsCount !== undefined && cfg.evcsCount !== null && String(cfg.evcsCount).trim() !== '')
6263
6488
  ? Number(cfg.evcsCount)
6264
6489
  : rawList.length;
6265
- const evcsCount = Math.max(0, Math.min(50, Math.round(Number.isFinite(rawCount) ? rawCount : 0)));
6490
+ const licenseMaxWallboxes = (typeof this._nwLicenseMaxWallboxes === 'function') ? Number(this._nwLicenseMaxWallboxes()) : 0;
6491
+ const evcsLimit = licenseMaxWallboxes > 0 ? Math.min(50, Math.max(0, Math.round(licenseMaxWallboxes))) : 50;
6492
+ const evcsCount = Math.max(0, Math.min(evcsLimit, Math.round(Number.isFinite(rawCount) ? rawCount : 0)));
6266
6493
  this.evcsCount = evcsCount;
6267
6494
  this.log.info(`[NexoWatt UI] Ladepunkte konfiguriert: ${evcsCount}`);
6268
6495
 
@@ -9104,6 +9331,10 @@ async onReady() {
9104
9331
  uuid: String(this._nwSystemUuid || ''),
9105
9332
  valid: !!this._nwLicenseOk,
9106
9333
  type: String(info.type || 'none'),
9334
+ edition: String(this._nwBuildLicenseFeatureInfo().edition || 'none'),
9335
+ editionLabel: String(this._nwBuildLicenseFeatureInfo().editionLabel || ''),
9336
+ maxWallboxes: Number(this._nwBuildLicenseFeatureInfo().maxWallboxes || 0),
9337
+ features: this._nwBuildLicenseFeatureInfo().features || {},
9107
9338
  message: String(info.msg || ''),
9108
9339
  expiresAt: Number(info.expiresAt || 0),
9109
9340
  daysRemaining: Number(info.daysRemaining || 0),
@@ -9159,6 +9390,10 @@ async onReady() {
9159
9390
  uuid: String(this._nwSystemUuid || ''),
9160
9391
  valid: !!this._nwLicenseOk,
9161
9392
  type: String(info.type || 'none'),
9393
+ edition: String(this._nwBuildLicenseFeatureInfo().edition || 'none'),
9394
+ editionLabel: String(this._nwBuildLicenseFeatureInfo().editionLabel || ''),
9395
+ maxWallboxes: Number(this._nwBuildLicenseFeatureInfo().maxWallboxes || 0),
9396
+ features: this._nwBuildLicenseFeatureInfo().features || {},
9162
9397
  message: this._nwLicenseOk
9163
9398
  ? 'Lizenz gespeichert und aktiviert ✅'
9164
9399
  : `Lizenz gespeichert, aber noch ungültig: ${String(info.msg || 'unbekannter Fehler')}`,
@@ -11458,7 +11693,7 @@ app.get('/api/smarthome/type-detect', requireInstaller, async (req, res) => {
11458
11693
  if (stored.groups && typeof stored.groups === 'object') out.groups = stored.groups;
11459
11694
  if (stored.meta && typeof stored.meta === 'object') out.meta = stored.meta;
11460
11695
 
11461
- return out;
11696
+ try { return this._nwApplyLicenseLimitsToEmsApps(out); } catch (_e) { return out; }
11462
11697
  };
11463
11698
  /**
11464
11699
  * Code-Teil: _nwApplyEmsAppsToLegacyFlags
@@ -11474,14 +11709,14 @@ app.get('/api/smarthome/type-detect', requireInstaller, async (req, res) => {
11474
11709
  for (const a of _nwAppCatalog) {
11475
11710
  if (!a.enableFlag) continue;
11476
11711
  const st = emsApps.apps && emsApps.apps[a.id] ? emsApps.apps[a.id] : null;
11477
- const enabled = !!(st && st.installed && st.enabled);
11712
+ const enabled = this._nwLicenseAllowsAppId(a.id) && !!(st && st.installed && st.enabled);
11478
11713
  n[a.enableFlag] = enabled;
11479
11714
  }
11480
11715
 
11481
11716
  // §14a is controlled via installerConfig.para14a
11482
11717
  try {
11483
11718
  const p = emsApps.apps && emsApps.apps.para14a ? emsApps.apps.para14a : null;
11484
- const active = !!(p && p.installed && p.enabled);
11719
+ const active = this._nwLicenseAllowsAppId('para14a') && !!(p && p.installed && p.enabled);
11485
11720
  n.installerConfig = (n.installerConfig && typeof n.installerConfig === 'object') ? n.installerConfig : {};
11486
11721
  n.installerConfig.para14a = active;
11487
11722
  } catch (_e) {
@@ -11521,6 +11756,7 @@ app.get('/api/smarthome/type-detect', requireInstaller, async (req, res) => {
11521
11756
 
11522
11757
  // Phase 2: App-Center state (install/enable)
11523
11758
  emsApps: _nwNormalizeEmsApps(n),
11759
+ license: this._nwBuildLicenseFeatureInfo(),
11524
11760
 
11525
11761
  // KI‑Energieberater
11526
11762
  aiAdvisor: (n.aiAdvisor && typeof n.aiAdvisor === 'object') ? n.aiAdvisor : undefined,
@@ -11582,7 +11818,9 @@ app.get('/api/smarthome/type-detect', requireInstaller, async (req, res) => {
11582
11818
  // system.adapter.<instance>.native. Persisting to native triggers an ioBroker instance restart
11583
11819
  // and breaks the UI with "Failed to fetch" + SSE disconnects.
11584
11820
  const nativeObj = (this.config && typeof this.config === 'object') ? this.config : {};
11585
- res.json({ ok: true, config: _nwPickInstallerConfig(nativeObj) });
11821
+ const cfgOut = _nwPickInstallerConfig(nativeObj);
11822
+ cfgOut.license = this._nwBuildLicenseFeatureInfo();
11823
+ res.json({ ok: true, config: cfgOut });
11586
11824
  } catch (e) {
11587
11825
  this.log.warn('Installer config API error: ' + e.message);
11588
11826
  res.status(500).json({ ok: false, error: 'internal error' });
@@ -11626,11 +11864,13 @@ app.get('/api/smarthome/type-detect', requireInstaller, async (req, res) => {
11626
11864
  if (!allowedRoot.has(k)) continue;
11627
11865
  safePatch[k] = v;
11628
11866
  }
11867
+ this._nwApplyLicenseLimitsToInstallerPatch(safePatch);
11629
11868
 
11630
11869
  // Persist (state-based) + apply to runtime config.
11631
11870
  // We merge into the already persisted patch (loaded on startup) to keep full configuration.
11632
11871
  const basePatch = (this._nwInstallerConfigPatch && typeof this._nwInstallerConfigPatch === 'object') ? this._nwInstallerConfigPatch : {};
11633
11872
  let mergedPatch = this.nwDeepMerge(this.nwDeepMerge({}, basePatch), safePatch);
11873
+ this._nwApplyLicenseLimitsToInstallerPatch(mergedPatch);
11634
11874
 
11635
11875
  // Map App toggles to legacy enable* flags and ensure forward-compatible shape
11636
11876
  mergedPatch = this.nwApplyEmsAppsToLegacyFlags(mergedPatch);
@@ -11706,7 +11946,9 @@ app.get('/api/smarthome/type-detect', requireInstaller, async (req, res) => {
11706
11946
  await _nwRestartEms();
11707
11947
  }
11708
11948
 
11709
- res.json({ ok: true, config: _nwPickInstallerConfig(this.config || {}), restarted: !!restartEms });
11949
+ const cfgOut = _nwPickInstallerConfig(this.config || {});
11950
+ cfgOut.license = this._nwBuildLicenseFeatureInfo();
11951
+ res.json({ ok: true, config: cfgOut, restarted: !!restartEms });
11710
11952
  } catch (e) {
11711
11953
  this.log.warn('Installer config save API error: ' + e.message);
11712
11954
  // Send a concise message to the frontend to avoid "Speichern fehlgeschlagen" without context.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.nexowatt-ui",
3
- "version": "0.8.2",
3
+ "version": "0.8.5",
4
4
  "description": "Responsive NexoWatt EMS visualization adapter.",
5
5
  "author": "NexoWatt",
6
6
  "license": "UNLICENSED",
@@ -18,8 +18,8 @@
18
18
  "admin:install": "npm --prefix src-admin-tab install",
19
19
  "admin:build": "npm --prefix src-admin-tab run build",
20
20
  "build": "npm run admin:build",
21
- "publish:check": "node scripts/ensure-publish-dev-deps.js && npm run git:conflicts && npm run check:tsconfig-modern && npm run check:ts-source-integrity && npm run check:ts-canonical && node scripts/verify-ts-runtime-mirrors.js && npm run check:ts-runtime-mirrors && npm run check:ts-runtime-executables && node scripts/verify-ts-script-mirrors.js && node scripts/verify-ts-frontend-mirrors.js && node scripts/verify-ts-backend-mirrors.js && node scripts/verify-ts-adapter-mirrors.js && node scripts/verify-ts-main-helpers.js && node scripts/verify-ts-feature-visibility-preview-runtime.js && node scripts/verify-ts-feature-visibility-effective-runtime.js && node scripts/verify-ts-energy-flow-mirrors.js && node scripts/verify-ts-energy-flow-shadow-runtime.js && node scripts/verify-ts-ems-mirrors.js && node scripts/verify-ts-ems-shadow-runtime.js && node scripts/verify-ts-customer-feature-visibility.js && node scripts/verify-ts-feature-visibility-shadow.js && node scripts/verify-ts-shadow-bridges.js && node scripts/verify-ts-feature-visibility-shadow-hook.js && npm run test:ems-shadow-runtime && node scripts/verify-ts-shadow-diagnostics-ui.js && node scripts/verify-ts-shadow-readiness.js && node scripts/verify-ts-energy-flow-switch-mode.js && node scripts/verify-ts-energy-flow-mode-ui.js && node scripts/verify-ts-energy-flow-candidate-mode.js && node scripts/verify-ts-energy-flow-safe-candidate-mode.js && node scripts/verify-shadow-diagnostics-usability.js && node scripts/verify-ts-shadow-diagnostics-ui-stability.js && node scripts/verify-ts-real-plant-shadow-evaluation.js && node scripts/verify-ts-shadow-real-plant-evaluation.js && node scripts/verify-ts-energy-flow-plant-gate.js && node scripts/verify-ts-energy-flow-active-test.js && node scripts/verify-ts-core-limits-runtime-typing.js && node scripts/verify-ts-heating-rod-runtime-typing.js && node scripts/verify-ts-ai-advisor-runtime-typing.js && node scripts/verify-ts-history-runtime-typing.js && node scripts/verify-ts-smarthome-runtime-typing.js && node scripts/verify-ts-smarthome-config-runtime-typing.js && node scripts/verify-ts-ems-apps-runtime-typing.js && node scripts/verify-ts-app-runtime-typing.js && node scripts/verify-ts-main-runtime-typing.js && node scripts/verify-ts-main-runtime-helpers.js && node scripts/verify-ts-adapter-helpers.js && node scripts/verify-ts-main-helpers-runtime.js && node scripts/verify-ts-api-state-set-shadow.js && node scripts/verify-ts-main-api-shadow.js && node scripts/verify-ts-energy-flow-fallback-reduction.js && node scripts/verify-ts-energy-flow-runtime-plant-reduction.js && node scripts/verify-ts-energy-flow-fixed-source-prep.js && node scripts/verify-ts-energy-flow-normal-source.js && node scripts/verify-energy-flow-deep-debug-scan.js && node scripts/verify-ts-core-limits-productive.js && node scripts/verify-ts-core-limits-reservations.js && node scripts/verify-ts-core-limits-reservations-productive.js && node scripts/verify-ts-core-limits-rest-gates.js && node scripts/verify-ts-core-limits-rest-gates-productive.js && node scripts/verify-ts-heating-rod-productive.js && node scripts/verify-ts-heating-rod-runtime-evaluation.js && node scripts/verify-ts-heating-rod-normal-path.js && node scripts/verify-ts-heating-rod-normal-takeover.js && node scripts/verify-ts-heating-rod-js-fallback-hard-only.js && node scripts/verify-ts-heating-rod-hard-fallback-only.js && node scripts/verify-ts-heating-rod-emergency-fallback.js && node scripts/verify-ts-heating-rod-legacy-cleanup.js && node scripts/verify-ts-heating-rod-legacy-removal-plan.js && node scripts/verify-ts-heating-rod-legacy-compact-cleanup.js && node scripts/verify-ts-ai-advisor-payload-productive.js && node scripts/verify-ts-live-dashboard-format-productive.js && node scripts/verify-ts-heating-rod-debug-bridge.js && node scripts/verify-ts-heating-rod-legacy-pruned-debug.js && node scripts/verify-ts-heating-rod-legacy-pruned.js && node scripts/verify-ts-heating-rod-legacy-removal-candidate.js && node scripts/verify-ts-heating-rod-legacy-final-cleanup.js && node scripts/verify-ts-heating-rod-normal-diagnostics-cleanup.js && node scripts/verify-ts-charging-management-shadow.js && node scripts/verify-ts-charging-management-control-shadow.js && node scripts/verify-ts-charging-control-productive-prep.js && node scripts/verify-ts-charging-budget-productive.js && node scripts/verify-ts-charging-control-productive.js && node scripts/verify-ts-charging-allocation-shadow.js && node scripts/verify-ts-charging-allocation-productive-prep.js && node scripts/verify-ts-charging-allocation-productive.js && node scripts/verify-ts-charging-write-plan-shadow.js && node scripts/verify-ts-charging-write-plan-productive.js && node scripts/verify-ts-charging-js-executor-fallback.js && node scripts/verify-ts-charging-safety-handover.js && node scripts/verify-ts-charging-normal-source-lockdown.js && node scripts/verify-ts-charging-final-handover.js && node scripts/verify-ts-runtime-js-cleanup.js && npm run test:brand-header-cleanup && npm run test:app-center-install-colors && node scripts/verify-publish.js && npm run test:main-api-productive && npm run test:shadow-json-ui && npm run test:energy-flow-live-test-states && npm run test:energy-flow-ts-productive && npm run test:energy-flow-productive-active && npm run test:energy-flow-productive-default",
22
- "prepublishOnly": "npm run publish:check",
21
+ "publish:check": "node scripts/ensure-publish-dev-deps.js && npm run git:conflicts && npm run check:tsconfig-modern && npm run check:ts-source-integrity && npm run check:ts-canonical && node scripts/verify-ts-runtime-mirrors.js && npm run check:ts-runtime-mirrors && npm run check:ts-runtime-executables && node scripts/verify-ts-script-mirrors.js && node scripts/verify-ts-frontend-mirrors.js && node scripts/verify-ts-backend-mirrors.js && node scripts/verify-ts-adapter-mirrors.js && node scripts/verify-ts-main-helpers.js && node scripts/verify-ts-feature-visibility-preview-runtime.js && node scripts/verify-ts-feature-visibility-effective-runtime.js && node scripts/verify-ts-energy-flow-mirrors.js && node scripts/verify-ts-energy-flow-shadow-runtime.js && node scripts/verify-ts-ems-mirrors.js && node scripts/verify-ts-ems-shadow-runtime.js && node scripts/verify-ts-customer-feature-visibility.js && node scripts/verify-ts-feature-visibility-shadow.js && node scripts/verify-ts-shadow-bridges.js && node scripts/verify-ts-feature-visibility-shadow-hook.js && npm run test:ems-shadow-runtime && node scripts/verify-ts-shadow-diagnostics-ui.js && node scripts/verify-ts-shadow-readiness.js && node scripts/verify-ts-energy-flow-switch-mode.js && node scripts/verify-ts-energy-flow-mode-ui.js && node scripts/verify-ts-energy-flow-candidate-mode.js && node scripts/verify-ts-energy-flow-safe-candidate-mode.js && node scripts/verify-shadow-diagnostics-usability.js && node scripts/verify-ts-shadow-diagnostics-ui-stability.js && node scripts/verify-ts-real-plant-shadow-evaluation.js && node scripts/verify-ts-shadow-real-plant-evaluation.js && node scripts/verify-ts-energy-flow-plant-gate.js && node scripts/verify-ts-energy-flow-active-test.js && node scripts/verify-ts-core-limits-runtime-typing.js && node scripts/verify-ts-heating-rod-runtime-typing.js && node scripts/verify-ts-ai-advisor-runtime-typing.js && node scripts/verify-ts-history-runtime-typing.js && node scripts/verify-ts-smarthome-runtime-typing.js && node scripts/verify-ts-smarthome-config-runtime-typing.js && node scripts/verify-ts-ems-apps-runtime-typing.js && node scripts/verify-ts-app-runtime-typing.js && node scripts/verify-ts-main-runtime-typing.js && node scripts/verify-ts-main-runtime-helpers.js && node scripts/verify-ts-adapter-helpers.js && node scripts/verify-ts-main-helpers-runtime.js && node scripts/verify-ts-api-state-set-shadow.js && node scripts/verify-ts-main-api-shadow.js && node scripts/verify-ts-energy-flow-fallback-reduction.js && node scripts/verify-ts-energy-flow-runtime-plant-reduction.js && node scripts/verify-ts-energy-flow-fixed-source-prep.js && node scripts/verify-ts-energy-flow-normal-source.js && node scripts/verify-energy-flow-deep-debug-scan.js && node scripts/verify-ts-core-limits-productive.js && node scripts/verify-ts-core-limits-reservations.js && node scripts/verify-ts-core-limits-reservations-productive.js && node scripts/verify-ts-core-limits-rest-gates.js && node scripts/verify-ts-core-limits-rest-gates-productive.js && node scripts/verify-ts-heating-rod-productive.js && node scripts/verify-ts-heating-rod-runtime-evaluation.js && node scripts/verify-ts-heating-rod-normal-path.js && node scripts/verify-ts-heating-rod-normal-takeover.js && node scripts/verify-ts-heating-rod-js-fallback-hard-only.js && node scripts/verify-ts-heating-rod-hard-fallback-only.js && node scripts/verify-ts-heating-rod-emergency-fallback.js && node scripts/verify-ts-heating-rod-legacy-cleanup.js && node scripts/verify-ts-heating-rod-legacy-removal-plan.js && node scripts/verify-ts-heating-rod-legacy-compact-cleanup.js && node scripts/verify-ts-ai-advisor-payload-productive.js && node scripts/verify-ts-live-dashboard-format-productive.js && node scripts/verify-ts-heating-rod-debug-bridge.js && node scripts/verify-ts-heating-rod-legacy-pruned-debug.js && node scripts/verify-ts-heating-rod-legacy-pruned.js && node scripts/verify-ts-heating-rod-legacy-removal-candidate.js && node scripts/verify-ts-heating-rod-legacy-final-cleanup.js && node scripts/verify-ts-heating-rod-normal-diagnostics-cleanup.js && node scripts/verify-ts-charging-management-shadow.js && node scripts/verify-ts-charging-management-control-shadow.js && node scripts/verify-ts-charging-control-productive-prep.js && node scripts/verify-ts-charging-budget-productive.js && node scripts/verify-ts-charging-control-productive.js && node scripts/verify-ts-charging-allocation-shadow.js && node scripts/verify-ts-charging-allocation-productive-prep.js && node scripts/verify-ts-charging-allocation-productive.js && node scripts/verify-ts-charging-write-plan-shadow.js && node scripts/verify-ts-charging-write-plan-productive.js && node scripts/verify-ts-charging-js-executor-fallback.js && node scripts/verify-ts-charging-safety-handover.js && node scripts/verify-ts-charging-normal-source-lockdown.js && node scripts/verify-ts-charging-final-handover.js && node scripts/verify-ts-runtime-js-cleanup.js && npm run test:brand-header-cleanup && npm run test:app-center-install-colors && npm run test:license-editions && node scripts/verify-publish.js && npm run test:main-api-productive && npm run test:shadow-json-ui && npm run test:energy-flow-live-test-states && npm run test:energy-flow-ts-productive && npm run test:energy-flow-productive-active && npm run test:energy-flow-productive-default",
22
+ "prepublishOnly": "npm run git:conflicts && node scripts/verify-publish.js",
23
23
  "test": "npm run test:all",
24
24
  "test:package": "node scripts/verify-publish.js && npm pack --dry-run",
25
25
  "test:js": "node scripts/verify-publish.js",
@@ -223,7 +223,9 @@
223
223
  "test:ts-runtime-js-cleanup": "node scripts/verify-ts-runtime-js-cleanup.js",
224
224
  "test:brand-header-cleanup": "npm run clean:ts && tsc -p tsconfig.brand-header-cleanup.json && node build-ts/brand-header-cleanup/tests/brand-header-cleanup-runtime.js",
225
225
  "test:app-center-install-colors": "npm run clean:ts && tsc -p tsconfig.app-center-install-colors.json && node build-ts/app-center-install-colors/tests/app-center-install-colors-runtime.js",
226
- "publish:deps": "node scripts/ensure-publish-dev-deps.js"
226
+ "publish:deps": "node scripts/ensure-publish-dev-deps.js",
227
+ "test:license-editions": "node scripts/verify-license-editions.js",
228
+ "publish:strict": "npm run publish:check && npm publish"
227
229
  },
228
230
  "dependencies": {
229
231
  "@iobroker/adapter-core": "^3.4.1",
package/www/ems-apps.html CHANGED
@@ -1591,84 +1591,7 @@
1591
1591
  <div id="chargingBudget" class="nw-config-grid"></div>
1592
1592
  </section>
1593
1593
 
1594
- <section class="nw-config-section">
1595
- <div class="nw-config-section__head">
1596
- <h2 class="nw-config-section__title">TypeScript Shadow‑Diagnose</h2>
1597
- <div class="nw-config-row__actions">
1598
- <button id="refreshShadowDiagnostics" type="button" class="nw-config-btn nw-config-btn--ghost">Aktualisieren</button>
1599
- </div>
1600
- </div>
1601
- <div class="nw-config-section__subtitle" style="margin:0 0 10px 0;opacity:.85;">
1602
- Lesbarer Vergleich zwischen aktueller JavaScript‑Runtime und TypeScript‑Spiegeln. Diese Kacheln zeigen, ob eine spätere TS-Umschaltung sicher vorbereitet ist.
1603
- </div>
1604
-
1605
- <div class="nw-config-card nw-ts-energyflow-mode-card">
1606
- <div class="nw-config-card__header">
1607
- <div>
1608
- <div class="nw-config-card__title">Energiefluss TypeScript‑Schaltmodus</div>
1609
- <div class="nw-config-card__subtitle">Steuert den Energiefluss-Quellmodus. Ab 0.7.101 ist TS der Standard-Kandidat, bleibt aber durch Shadow, Warmup, Kandidatenprüfung und Anlagen-Gate abgesichert.</div>
1610
- </div>
1611
- </div>
1612
- <div class="nw-config-card__body nw-ts-energyflow-mode-grid">
1613
- <label class="nw-config-field-row" for="energyFlowTsMode">
1614
- <span class="nw-config-field-label">Modus</span>
1615
- <span class="nw-config-field-control">
1616
- <select id="energyFlowTsMode" class="nw-config-input">
1617
- <option value="js">JS – nur alte Runtime</option>
1618
- <option value="shadow">Shadow – JS produktiv, TS Diagnose</option>
1619
- <option value="ts">TS – produktiver Kandidat mit Sicherheitsgates</option>
1620
- </select>
1621
- </span>
1622
- </label>
1623
-
1624
- <label class="nw-config-checklabel nw-ts-energyflow-production-row">
1625
- <input id="energyFlowTsProductionAllowed" class="nw-config-checkbox" type="checkbox" />
1626
- <span>Produktive TS‑Freigabe erlauben</span>
1627
- </label>
1628
-
1629
- <label class="nw-config-field-row" for="energyFlowTsWarmupTicks">
1630
- <span class="nw-config-field-label">Kandidaten‑Warmup</span>
1631
- <span class="nw-config-field-control">
1632
- <input id="energyFlowTsWarmupTicks" class="nw-config-input" type="number" min="1" max="30" step="1" placeholder="3" />
1633
- </span>
1634
- </label>
1635
-
1636
- <label class="nw-config-checklabel nw-ts-energyflow-fallback-row">
1637
- <input id="energyFlowTsAutoFallback" class="nw-config-checkbox" type="checkbox" />
1638
- <span>Automatisch auf JS zurückfallen, wenn Shadow abweicht</span>
1639
- </label>
1640
-
1641
- <label class="nw-config-checklabel nw-ts-energyflow-plant-row">
1642
- <input id="energyFlowTsRequireStablePlant" class="nw-config-checkbox" type="checkbox" />
1643
- <span>TS erst nach stabiler realer Anlagen-Auswertung erlauben</span>
1644
- </label>
1645
-
1646
- <label class="nw-config-field-row" for="energyFlowTsPlantMinSamples">
1647
- <span class="nw-config-field-label">Mindest-Samples Anlage</span>
1648
- <span class="nw-config-field-control">
1649
- <input id="energyFlowTsPlantMinSamples" class="nw-config-input" type="number" min="1" max="120" step="1" placeholder="5" />
1650
- </span>
1651
- </label>
1652
-
1653
- <label class="nw-config-field-row" for="energyFlowTsPlantMinOk">
1654
- <span class="nw-config-field-label">OK-Samples in Folge</span>
1655
- <span class="nw-config-field-control">
1656
- <input id="energyFlowTsPlantMinOk" class="nw-config-input" type="number" min="1" max="120" step="1" placeholder="5" />
1657
- </span>
1658
- </label>
1659
-
1660
- <div class="nw-config-empty nw-ts-energyflow-safety-note">
1661
- Sicherheitsregel: TS ist der Standard-Kandidat, wird aber nur produktiv genutzt, wenn diese Freigabe aktiv ist, Shadow/Kandidat/Warmup und reale Anlagen-Auswertung sauber sind. Rückfall auf <b>JS</b> oder <b>Shadow</b> bleibt jederzeit möglich.
1662
- </div>
1663
-
1664
- <div id="energyFlowTsModeStatus" class="nw-config-empty nw-ts-energyflow-mode-status">
1665
- Aktueller Modus wird nach dem Laden der Konfiguration angezeigt.
1666
- </div>
1667
- </div>
1668
- </div>
1669
-
1670
- <div id="shadowDiagnostics" class="nw-config-grid"></div>
1671
- </section>
1594
+ <!-- Interne TypeScript-Migrationsdiagnosen sind ab 0.8.3 aus der Benutzeroberfläche entfernt. -->
1672
1595
 
1673
1596
  <section class="nw-config-section">
1674
1597
  <div class="nw-config-section__head">
package/www/ems-apps.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * AUTO-GENERATED RUNTIME FILE - NICHT MANUELL BEARBEITEN.
3
3
  *
4
4
  * Quelle: src-ts/runtime-executables/www/ems-apps.ts
5
- * Quell-Hash: sha256:981f77b76a75ceddd88a7b8e46034282187d9754b45421897945f7d90e7c780e
5
+ * Quell-Hash: sha256:e4b01067d18ee01030088980b68d7ba576ef8815c3605cc75ecac50a840c7381
6
6
  * Erzeugung: npm run sync:ts-runtime-executables
7
7
  *
8
8
  * Zweck:
@@ -345,21 +345,21 @@
345
345
 
346
346
  // Phase 2: App-Center (install + enable per capability)
347
347
  const APP_CATALOG = [
348
- { id: 'charging', label: 'Lademanagement', desc: 'PV-Überschussladen, Budget-Verteilung, Ladepunkte/Ports (AC/DC) + Stationsgruppen', mandatory: false },
349
- { id: 'peak', label: 'Peak-Shaving', desc: 'Lastspitzenkappung / Import-Limit / Atypische HLZF', mandatory: false },
350
- { id: 'storage', label: 'Speicherregelung', desc: 'Eigenverbrauch / Speicher-Setpoints (herstellerunabhängig)', mandatory: false },
351
- { id: 'storagefarm', label: 'Speicherfarm', desc: 'Mehrere Speichersysteme als Pool/Gruppen', mandatory: false },
352
- { id: 'thermal', label: 'Wärmepumpe & Klima', desc: 'PV-Überschuss-Steuerung für Wärmepumpe/Klima (Setpoint, On/Off oder SG-Ready) inkl. Schnellsteuerung', mandatory: false },
353
- { id: 'heatingrod', label: 'Heizstab', desc: 'Native 1..12 Stufen Heizstab-Regelung über Relais / KNX-Aktoren', mandatory: false },
354
- { id: 'bhkw', label: 'BHKW', desc: 'BHKW-Steuerung (Start/Stop, SoC-geführt) mit Schnellsteuerung', mandatory: false },
355
- { id: 'generator', label: 'Generator', desc: 'Generator-Steuerung (Notstrom/Netzparallelbetrieb, SoC-geführt) mit Schnellsteuerung', mandatory: false },
356
- { id: 'threshold', label: 'Schwellwertsteuerung', desc: 'Regeln (Wenn X > Y dann Schalten/Setzen) – optional mit Endkunden-Anpassung', mandatory: false },
357
- { id: 'relay', label: 'Relaissteuerung', desc: 'Manuelle Relais / generische Ausgänge (optional endkundentauglich)', mandatory: false },
358
- { id: 'grid', label: 'Netzlimits', desc: 'Netzrestriktionen (RLM/0‑Einspeisung/Import‑Limits)', mandatory: false },
359
- { id: 'aiAdvisor', label: 'KI‑Energieberater', desc: 'Beratende KI‑Optimierung: PV, Wetter, Tarif, Speicher, Wallboxen und Lastspitzen als Vorschläge auf der LIVE‑Seite', mandatory: false },
360
- { id: 'tariff', label: 'Tarife', desc: 'Preis-Signal / Ladepark-Budget / Netzladung-Freigabe', mandatory: true },
361
- { id: 'para14a', label: '§14a Steuerung', desc: 'Abregelung/Leistungsdeckel für steuerbare Verbraucher (falls genutzt)', mandatory: false },
362
- { id: 'multiuse', label: 'MultiUse', desc: 'Speicher Multi‑Use (SoC‑Zonen: Notstrom/LSK/Eigenverbrauch)', mandatory: false }
348
+ { id: 'charging', label: 'Lademanagement', desc: 'PV-Überschussladen, Budget-Verteilung, Ladepunkte/Ports (AC/DC) + Stationsgruppen', mandatory: false, hems: true },
349
+ { id: 'peak', label: 'Peak-Shaving', desc: 'Lastspitzenkappung / Import-Limit / Atypische HLZF', mandatory: false, hems: false },
350
+ { id: 'storage', label: 'Speicherregelung', desc: 'Eigenverbrauch / Speicher-Setpoints (herstellerunabhängig)', mandatory: false, hems: true },
351
+ { id: 'storagefarm', label: 'Speicherfarm', desc: 'Mehrere Speichersysteme als Pool/Gruppen', mandatory: false, hems: false },
352
+ { id: 'thermal', label: 'Wärmepumpe & Klima', desc: 'PV-Überschuss-Steuerung für Wärmepumpe/Klima (Setpoint, On/Off oder SG-Ready) inkl. Schnellsteuerung', mandatory: false, hems: true },
353
+ { id: 'heatingrod', label: 'Heizstab', desc: 'Native 1..12 Stufen Heizstab-Regelung über Relais / KNX-Aktoren', mandatory: false, hems: true },
354
+ { id: 'bhkw', label: 'BHKW', desc: 'BHKW-Steuerung (Start/Stop, SoC-geführt) mit Schnellsteuerung', mandatory: false, hems: false },
355
+ { id: 'generator', label: 'Generator', desc: 'Generator-Steuerung (Notstrom/Netzparallelbetrieb, SoC-geführt) mit Schnellsteuerung', mandatory: false, hems: false },
356
+ { id: 'threshold', label: 'Schwellwertsteuerung', desc: 'Regeln (Wenn X > Y dann Schalten/Setzen) – optional mit Endkunden-Anpassung', mandatory: false, hems: true },
357
+ { id: 'relay', label: 'Relaissteuerung', desc: 'Manuelle Relais / generische Ausgänge (optional endkundentauglich)', mandatory: false, hems: true },
358
+ { id: 'grid', label: 'Netzlimits', desc: 'Netzrestriktionen (RLM/0‑Einspeisung/Import‑Limits)', mandatory: false, hems: false },
359
+ { id: 'aiAdvisor', label: 'KI‑Energieberater', desc: 'Beratende KI‑Optimierung: PV, Wetter, Tarif, Speicher, Wallboxen und Lastspitzen als Vorschläge auf der LIVE‑Seite', mandatory: false, hems: true },
360
+ { id: 'tariff', label: 'Tarife', desc: 'Preis-Signal / Ladepark-Budget / Netzladung-Freigabe', mandatory: true, hems: true },
361
+ { id: 'para14a', label: '§14a Steuerung', desc: 'Abregelung/Leistungsdeckel für steuerbare Verbraucher (falls genutzt)', mandatory: false, hems: true },
362
+ { id: 'multiuse', label: 'MultiUse', desc: 'Speicher Multi‑Use (SoC‑Zonen: Notstrom/LSK/Eigenverbrauch)', mandatory: false, hems: false }
363
363
  ];
364
364
 
365
365
 
@@ -831,6 +831,7 @@
831
831
  ];
832
832
 
833
833
  let currentConfig = null;
834
+ let currentLicenseInfo = { valid: false, edition: 'none', editionLabel: 'Keine Lizenz', maxWallboxes: 0, features: {} };
834
835
  let dpTargetInputId = null;
835
836
  let treePrefix = '';
836
837
 
@@ -848,6 +849,67 @@
848
849
  */
849
850
  const shadowJsonDetailsOpen = new Set();
850
851
 
852
+
853
+ const HEMS_APP_IDS = new Set(['charging', 'storage', 'thermal', 'heatingrod', 'threshold', 'relay', 'aiAdvisor', 'tariff', 'para14a']);
854
+ const APP_LICENSE_FEATURES = Object.freeze({
855
+ charging: 'chargingManagement',
856
+ peak: 'peakShaving',
857
+ storage: 'storageControl',
858
+ storagefarm: 'storageFarm',
859
+ thermal: 'thermalControl',
860
+ heatingrod: 'heatingRodControl',
861
+ bhkw: 'bhkwControl',
862
+ generator: 'generatorControl',
863
+ threshold: 'thresholdControl',
864
+ relay: 'relayControl',
865
+ grid: 'gridConstraints',
866
+ aiAdvisor: 'aiAdvisor',
867
+ tariff: 'dynamicTariffs',
868
+ para14a: 'para14a',
869
+ multiuse: 'multiUse'
870
+ });
871
+
872
+ function _licenseEdition() {
873
+ const info = currentLicenseInfo && typeof currentLicenseInfo === 'object' ? currentLicenseInfo : {};
874
+ const e = String(info.edition || '').trim().toLowerCase();
875
+ if (e === 'eos') return 'eos';
876
+ if (e === 'hems') return 'hems';
877
+ return 'none';
878
+ }
879
+
880
+ function _appLicenseFeature(appId) {
881
+ return APP_LICENSE_FEATURES[String(appId || '')] || String(appId || '');
882
+ }
883
+
884
+ function _isFeatureLicensed(feature) {
885
+ const ed = _licenseEdition();
886
+ if (ed === 'eos') return true;
887
+ if (ed !== 'hems') return false;
888
+ const features = currentLicenseInfo && currentLicenseInfo.features && typeof currentLicenseInfo.features === 'object' ? currentLicenseInfo.features : {};
889
+ const f = String(feature || '');
890
+ if (Object.prototype.hasOwnProperty.call(features, f)) return !!features[f];
891
+ return HEMS_APP_IDS.has(String(feature || ''));
892
+ }
893
+
894
+ function _isAppLicensed(appId) {
895
+ const ed = _licenseEdition();
896
+ if (ed === 'eos') return true;
897
+ if (ed === 'hems') return HEMS_APP_IDS.has(String(appId || '')) || _isFeatureLicensed(_appLicenseFeature(appId));
898
+ return false;
899
+ }
900
+
901
+ function _maxEvcsCount() {
902
+ const max = Number(currentLicenseInfo && currentLicenseInfo.maxWallboxes);
903
+ return Number.isFinite(max) && max > 0 ? Math.max(0, Math.min(50, Math.round(max))) : 50;
904
+ }
905
+
906
+ function _licenseLabel() {
907
+ const ed = _licenseEdition();
908
+ if (ed === 'eos') return 'EOS';
909
+ if (ed === 'hems') return 'HEMS';
910
+ return 'Keine Lizenz';
911
+ }
912
+
851
913
  /**
852
914
  * Code-Teil: _decodeShadowDisplayText
853
915
  *
@@ -1435,7 +1497,14 @@ function collectAiAdvisorConfigFromUI(base) {
1435
1497
  return a && typeof a === 'object' ? a : { installed: false, enabled: false };
1436
1498
  };
1437
1499
 
1438
- for (const app of APP_CATALOG) {
1500
+ const licenseCard = document.createElement('div');
1501
+ licenseCard.className = 'nw-config-card nw-license-edition-card';
1502
+ const licenseLimit = _maxEvcsCount() < 50 ? ` · Lademanagement bis ${_maxEvcsCount()} Wallboxen` : ' · Vollzugriff';
1503
+ licenseCard.innerHTML = `<div class="nw-config-card__header"><div><div class="nw-config-card__title">Lizenz: ${_licenseLabel()}</div><div class="nw-config-card__subtitle">${_licenseEdition() === 'eos' ? 'EOS ist die Vollversion mit allen Apps und künftigen Erweiterungen.' : 'HEMS zeigt nur die freigegebenen Apps.'}${licenseLimit}</div></div></div>`;
1504
+ els.appsList.appendChild(licenseCard);
1505
+
1506
+ const visibleApps = APP_CATALOG.filter((app) => _isAppLicensed(app.id));
1507
+ for (const app of visibleApps) {
1439
1508
  const st = getSt(app.id);
1440
1509
 
1441
1510
  const card = document.createElement('div');
@@ -1557,7 +1626,9 @@ function collectAiAdvisorConfigFromUI(base) {
1557
1626
  if (app.id === 'charging') {
1558
1627
  const row = document.createElement('div');
1559
1628
  row.className = 'nw-config-card__row';
1560
- row.textContent = 'Konfiguration: Reiter „Ladepunkte“. Datenpunkte: pro Ladepunkt.';
1629
+ row.textContent = _licenseEdition() === 'hems'
1630
+ ? 'Konfiguration: Reiter „Ladepunkte“. HEMS erlaubt bis zu 3 Wallboxen.'
1631
+ : 'Konfiguration: Reiter „Ladepunkte“. Datenpunkte: pro Ladepunkt.';
1561
1632
  body.appendChild(row);
1562
1633
  }
1563
1634
  if (app.id === 'peak') {
@@ -1579,7 +1650,7 @@ function collectAiAdvisorConfigFromUI(base) {
1579
1650
  els.appsList.appendChild(card);
1580
1651
  }
1581
1652
 
1582
- els.appsEmpty.style.display = APP_CATALOG.length ? 'none' : 'block';
1653
+ els.appsEmpty.style.display = visibleApps.length ? 'none' : 'block';
1583
1654
  }
1584
1655
  /**
1585
1656
  * Code-Teil: setAppsFromConfig
@@ -8003,6 +8074,7 @@ function collectAiAdvisorConfigFromUI(base) {
8003
8074
  * TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
8004
8075
  */
8005
8076
  function _ensureEvcsList(count) {
8077
+ count = _clampInt(count, 0, _maxEvcsCount(), 0);
8006
8078
  const sc = _ensureSettingsConfig();
8007
8079
  const list = Array.isArray(sc.evcsList) ? sc.evcsList : [];
8008
8080
  while (list.length < count) list.push({});
@@ -8018,7 +8090,7 @@ function collectAiAdvisorConfigFromUI(base) {
8018
8090
  */
8019
8091
  function _updateEvcsField(idx, field, value) {
8020
8092
  const sc = _ensureSettingsConfig();
8021
- const count = _clampInt(sc.evcsCount, 0, 50, 0);
8093
+ const count = _clampInt(sc.evcsCount, 0, _maxEvcsCount(), 0);
8022
8094
  const list = _ensureEvcsList(count);
8023
8095
  const row = (list[idx - 1] && typeof list[idx - 1] === 'object') ? list[idx - 1] : {};
8024
8096
  row[field] = value;
@@ -8034,10 +8106,11 @@ function collectAiAdvisorConfigFromUI(base) {
8034
8106
  function buildEvcsUI() {
8035
8107
  if (!els.evcsList || !els.evcsCount) return;
8036
8108
  const sc = _ensureSettingsConfig();
8037
- const count = _clampInt(sc.evcsCount, 0, 50, 0);
8109
+ const count = _clampInt(sc.evcsCount, 0, _maxEvcsCount(), 0);
8038
8110
  sc.evcsCount = count;
8039
8111
 
8040
8112
  els.evcsCount.value = String(count);
8113
+ try { els.evcsCount.max = String(_maxEvcsCount()); } catch (_e) {}
8041
8114
  if (els.evcsMaxPowerKw) {
8042
8115
  const kw = (sc.evcsMaxPowerKw !== undefined && sc.evcsMaxPowerKw !== null) ? Number(sc.evcsMaxPowerKw) : 11;
8043
8116
  els.evcsMaxPowerKw.value = Number.isFinite(kw) ? String(kw) : '11';
@@ -8276,8 +8349,8 @@ function collectAiAdvisorConfigFromUI(base) {
8276
8349
  const addPortToStation = (stationKey) => {
8277
8350
  const sk = normKey(stationKey);
8278
8351
  const sc2 = _ensureSettingsConfig();
8279
- const cur = _clampInt(sc2.evcsCount, 0, 50, 0);
8280
- if (cur >= 20) return;
8352
+ const cur = _clampInt(sc2.evcsCount, 0, _maxEvcsCount(), 0);
8353
+ if (cur >= Math.min(20, _maxEvcsCount())) return;
8281
8354
 
8282
8355
  const next = cur + 1;
8283
8356
  sc2.evcsCount = next;
@@ -8950,7 +9023,7 @@ function collectAiAdvisorConfigFromUI(base) {
8950
9023
  */
8951
9024
  function collectSettingsConfigFromUI() {
8952
9025
  const out = deepMerge({}, (currentConfig && currentConfig.settingsConfig) ? currentConfig.settingsConfig : {});
8953
- const count = _clampInt(els.evcsCount ? els.evcsCount.value : out.evcsCount, 0, 50, 0);
9026
+ const count = _clampInt(els.evcsCount ? els.evcsCount.value : out.evcsCount, 0, _maxEvcsCount(), 0);
8954
9027
  out.evcsCount = count;
8955
9028
 
8956
9029
  if (els.evcsMaxPowerKw) {
@@ -8973,6 +9046,9 @@ function collectAiAdvisorConfigFromUI(base) {
8973
9046
  */
8974
9047
  function applyConfigToUI(cfg) {
8975
9048
  currentConfig = cfg || {};
9049
+ currentLicenseInfo = (currentConfig.license && typeof currentConfig.license === 'object')
9050
+ ? currentConfig.license
9051
+ : { valid: false, edition: 'none', editionLabel: 'Keine Lizenz', maxWallboxes: 0, features: {} };
8976
9052
 
8977
9053
  // Apps
8978
9054
  setAppsFromConfig(currentConfig);
@@ -10139,6 +10215,17 @@ function collectAiAdvisorConfigFromUI(base) {
10139
10215
  for (const app of APP_CATALOG) {
10140
10216
  const i1 = document.getElementById(`app_${app.id}_installed`);
10141
10217
  const i2 = document.getElementById(`app_${app.id}_enabled`);
10218
+ if (!_isAppLicensed(app.id)) {
10219
+ patch.emsApps.apps[app.id] = { installed: false, enabled: false, licenseBlocked: true, requiredLicense: 'EOS' };
10220
+ continue;
10221
+ }
10222
+ if (!i1 && !i2) {
10223
+ const existing = currentConfig && currentConfig.emsApps && currentConfig.emsApps.apps && currentConfig.emsApps.apps[app.id]
10224
+ ? currentConfig.emsApps.apps[app.id]
10225
+ : { installed: false, enabled: false };
10226
+ patch.emsApps.apps[app.id] = deepMerge({}, existing);
10227
+ continue;
10228
+ }
10142
10229
  const installed = app.mandatory ? true : !!(i1 && i1.checked);
10143
10230
  const enabled = app.mandatory ? true : !!(i2 && i2.checked);
10144
10231
  patch.emsApps.apps[app.id] = { installed, enabled };
@@ -11048,12 +11135,16 @@ function collectAiAdvisorConfigFromUI(base) {
11048
11135
  */
11049
11136
  function collectEnergyFlowTsMigrationFromUi(base) {
11050
11137
  const out = deepMerge({}, (base && typeof base === 'object') ? base : {});
11051
- out.energyFlowMode = _normalizeEnergyFlowTsModeUi(els.energyFlowTsMode ? els.energyFlowTsMode.value : out.energyFlowMode);
11052
- out.energyFlowProductionAllowed = !!(els.energyFlowTsProductionAllowed && els.energyFlowTsProductionAllowed.checked);
11138
+ if (els.energyFlowTsMode) out.energyFlowMode = _normalizeEnergyFlowTsModeUi(els.energyFlowTsMode.value || out.energyFlowMode);
11139
+ else out.energyFlowMode = _normalizeEnergyFlowTsModeUi(out.energyFlowMode || 'ts');
11140
+ if (els.energyFlowTsProductionAllowed) out.energyFlowProductionAllowed = !!els.energyFlowTsProductionAllowed.checked;
11141
+ else out.energyFlowProductionAllowed = out.energyFlowProductionAllowed !== false;
11053
11142
  const warmup = Math.round(Number(els.energyFlowTsWarmupTicks ? els.energyFlowTsWarmupTicks.value : out.energyFlowCandidateWarmupTicks));
11054
11143
  out.energyFlowCandidateWarmupTicks = Number.isFinite(warmup) ? Math.max(1, Math.min(30, warmup)) : 3;
11055
- out.energyFlowCandidateAutoFallback = !(els.energyFlowTsAutoFallback && els.energyFlowTsAutoFallback.checked === false);
11056
- out.energyFlowRequireStablePlantEvaluation = !(els.energyFlowTsRequireStablePlant && els.energyFlowTsRequireStablePlant.checked === false);
11144
+ if (els.energyFlowTsAutoFallback) out.energyFlowCandidateAutoFallback = !(els.energyFlowTsAutoFallback.checked === false);
11145
+ else out.energyFlowCandidateAutoFallback = out.energyFlowCandidateAutoFallback !== false;
11146
+ if (els.energyFlowTsRequireStablePlant) out.energyFlowRequireStablePlantEvaluation = !(els.energyFlowTsRequireStablePlant.checked === false);
11147
+ else out.energyFlowRequireStablePlantEvaluation = out.energyFlowRequireStablePlantEvaluation !== false;
11057
11148
  const plantSamples = Math.round(Number(els.energyFlowTsPlantMinSamples ? els.energyFlowTsPlantMinSamples.value : out.energyFlowPlantMinSamples));
11058
11149
  out.energyFlowPlantMinSamples = Number.isFinite(plantSamples) ? Math.max(1, Math.min(120, plantSamples)) : 5;
11059
11150
  const plantOk = Math.round(Number(els.energyFlowTsPlantMinOk ? els.energyFlowTsPlantMinOk.value : out.energyFlowPlantMinConsecutiveOk));
@@ -11851,7 +11942,7 @@ function collectAiAdvisorConfigFromUI(base) {
11851
11942
  if (_activeTab !== 'status') return;
11852
11943
  const data = await fetchJson('/api/ems/charging/diagnostics');
11853
11944
  renderChargingBudget(data || {});
11854
- renderShadowDiagnostics(data || {});
11945
+ // TS-Migrationsdiagnosen bleiben intern über die API verfügbar, werden ab 0.8.3 aber nicht mehr sichtbar im App-Center gerendert.
11855
11946
  renderChargingDiag(data || {});
11856
11947
  renderStationsDiag(data || {});
11857
11948
  }
@@ -12426,7 +12517,7 @@ function collectAiAdvisorConfigFromUI(base) {
12426
12517
  // Ereignis-Kommentar: Bindet das UI-Ereignis 'change' an els.evcsCount. Beim Umbau prüfen, welche DOM-Elemente/States dadurch geändert werden.
12427
12518
  els.evcsCount.addEventListener('change', () => {
12428
12519
  const sc = _ensureSettingsConfig();
12429
- sc.evcsCount = _clampInt(els.evcsCount.value, 0, 50, 0);
12520
+ sc.evcsCount = _clampInt(els.evcsCount.value, 0, _maxEvcsCount(), 0);
12430
12521
  buildEvcsUI();
12431
12522
  });
12432
12523
  }
@@ -44,5 +44,5 @@
44
44
  "purpose": "maskable"
45
45
  }
46
46
  ],
47
- "version": "0.8.2"
47
+ "version": "0.8.5"
48
48
  }
package/www/sw.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * AUTO-GENERATED RUNTIME FILE - NICHT MANUELL BEARBEITEN.
3
3
  *
4
4
  * Quelle: src-ts/runtime-executables/www/sw.ts
5
- * Quell-Hash: sha256:d5d4068cd64f670855116aa7d8152f83a104be3c255d6be238f5398c4287a957
5
+ * Quell-Hash: sha256:0b26a1232ed0de61ba9f63979cf6f840476f78533df8e4f832ffd418f539ae9f
6
6
  * Erzeugung: npm run sync:ts-runtime-executables
7
7
  *
8
8
  * Zweck:
@@ -42,7 +42,7 @@
42
42
 
43
43
  // Increment cache name on releases so browser updates JS/HTML reliably.
44
44
  // NOTE: Keep this monotonic to force SW updates on hotfixes.
45
- const CACHE_NAME = 'nexowatt-cache-v303';
45
+ const CACHE_NAME = 'nexowatt-cache-v306';
46
46
 
47
47
  const OFFLINE_URLS = [
48
48
  './',
@@ -1,66 +0,0 @@
1
- <!--
2
- Datei: admin/license-generator.html
3
- Rolle: Code-Datei
4
- Zweck: Allgemeiner Projektcode; genaue Verantwortung ergibt sich aus Pfad und Funktionsnamen.
5
- Wartung: HTML-IDs/Klassen sind Vertragsstellen für www/*.js und CSS. Nicht ohne Suche nach Referenzen ändern.
6
- -->
7
- <!DOCTYPE html>
8
- <!--
9
- NexoWatt Code-Kommentar (DE)
10
- Zweck: Statische Admin-/Redirect-Seite für ioBroker Admin oder Installer-Start.
11
- Zusammenhänge:
12
- - Verlinkt auf Kunden-/Installerseiten oder React-Admin-Tab.
13
- - Wird durch ioBroker Admin bzw. Adapter-Webserver ausgeliefert.
14
- Wartungshinweise:
15
- - Keine Kundenfunktionen ohne Berechtigung freigeben.
16
- -->
17
- <html lang="de">
18
- <head>
19
- <meta charset="utf-8" />
20
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
21
- <title>NexoWatt – Installer</title>
22
- <style>
23
- html, body { height: 100%; }
24
- body {
25
- margin: 0;
26
- display: grid;
27
- place-items: center;
28
- background: #0b1220;
29
- color: rgba(255,255,255,0.92);
30
- font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, sans-serif;
31
- }
32
- .box {
33
- max-width: 640px;
34
- padding: 24px;
35
- text-align: center;
36
- border: 1px solid rgba(148,163,184,0.22);
37
- border-radius: 18px;
38
- background: rgba(2,6,23,0.55);
39
- box-shadow: 0 20px 60px rgba(0,0,0,0.35);
40
- }
41
- a { color: #22c55e; }
42
- </style>
43
- <script>
44
- (function () {
45
- var search = window.location.search || '';
46
- var target = 'react/index.html' + search + '#/installer';
47
- window.__nwReactAdminTarget = target;
48
- window.location.replace(target);
49
- })();
50
- </script>
51
- </head>
52
- <body>
53
- <div class="box">
54
- <h1>NexoWatt – Installer</h1>
55
- <p>Seite wird geladen. Falls die Weiterleitung blockiert wird, öffne bitte <a id="manualLink" href="react/index.html#/installer">diese Seite</a>.</p>
56
- </div>
57
- <script>
58
- (function () {
59
- var link = document.getElementById('manualLink');
60
- if (link && window.__nwReactAdminTarget) {
61
- link.href = window.__nwReactAdminTarget;
62
- }
63
- })();
64
- </script>
65
- </body>
66
- </html>