iobroker.eos-admin 9.0.17 → 9.0.18
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/NEXOWATT_EOS_BUILD_INFO.json +12 -14
- package/README.md +5 -3
- package/START_HIER_9.0.18.md +47 -0
- package/adminWww/.vite/manifest.json +39 -39
- package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +107 -107
- package/adminWww/assets/{AdapterUpdateDialog-Cpo3dAfY.js → AdapterUpdateDialog-ByJk9Cxj.js} +1 -1
- package/adminWww/assets/{Adapters-n2ukPDdC.js → Adapters-V2JtEPZX.js} +1 -1
- package/adminWww/assets/{ConfigManager-BVZ6_Ebo.js → ConfigManager-BKcdyJnN.js} +1 -1
- package/adminWww/assets/{Enums-CQ6yHG2W.js → Enums-ChbfAWzp.js} +1 -1
- package/adminWww/assets/{Fields-CaJqzoW-.js → Fields-DzaVXEvg.js} +1 -1
- package/adminWww/assets/{Files-DfvpKGa3.js → Files-CRpIXj4X.js} +1 -1
- package/adminWww/assets/{Hosts-3xLBsdG6.js → Hosts-rOgfd2wo.js} +1 -1
- package/adminWww/assets/{Instances-B7hKEhyw.js → Instances-BxLhJ6Pb.js} +1 -1
- package/adminWww/assets/{Intro-BV4kYZdT.js → Intro-BOql527d.js} +1 -1
- package/adminWww/assets/{Logs-DpL9eY69.js → Logs-WUUDY7a4.js} +1 -1
- package/adminWww/assets/{Objects-dN06jhQk.js → Objects-DYaZkCK7.js} +1 -1
- package/adminWww/assets/{Overview-Lip63_ej.js → Overview-C6hiiPbm.js} +1 -1
- package/adminWww/assets/{State-BSO2X_xN.js → State-AH43l7fG.js} +1 -1
- package/adminWww/assets/{UsedResources-DvqzszKI.js → UsedResources-jhsRMH4X.js} +1 -1
- package/adminWww/assets/{Users-Csqd1xA-.js → Users-D9wyLyJ1.js} +1 -1
- package/adminWww/assets/{bootstrap-C3HM8kNL.js → bootstrap-gVLo1K_2.js} +3 -3
- package/adminWww/assets/{hostInit-DdxBUeXQ.js → hostInit-Dt_M-NAC.js} +1 -1
- package/adminWww/assets/{icons-material-D1Tb_725.js → icons-material-DuVW_EUA.js} +1 -1
- package/adminWww/assets/{index-BOujTMyH.js → index-B1cnPkSO.js} +2 -2
- package/adminWww/assets/{installSVGRenderer-BZyrUVAo.js → installSVGRenderer-GvgHjubR.js} +1 -1
- package/adminWww/assets/{mf-entry-bootstrap-0-3418586b.js → mf-entry-bootstrap-0-6b32b635.js} +2 -2
- package/adminWww/index.html +23 -23
- package/adminWww/mf-manifest.json +1 -1
- package/adminWww/mf-stats.json +1 -1
- package/adminWww/remoteEntry-eos-9.0.18.js +12 -0
- package/adminWww/remoteEntry.js +1 -1
- package/build/lib/eosDeviceEmsPlan.js +739 -0
- package/build/lib/eosDeviceEmsPlan.js.map +1 -0
- package/build/lib/eosDeviceEmsService.js +377 -0
- package/build/lib/eosDeviceEmsService.js.map +1 -0
- package/build/lib/eosModuleHost.js +53 -2
- package/build/lib/eosModuleHost.js.map +1 -1
- package/build/lib/eosModuleHttp.js +1 -1
- package/build/lib/eosModuleHttp.js.map +1 -1
- package/build/lib/web.js +15 -0
- package/build/lib/web.js.map +1 -1
- package/docs/reports/unified-9.0.18/ALIAS_V1_COVERAGE.json +5056 -0
- package/docs/reports/unified-9.0.18/ALIAS_V1_VERTRAG.md +257 -0
- package/docs/reports/unified-9.0.18/ANFORDERUNGEN.md +55 -0
- package/docs/reports/unified-9.0.18/CUSTOMER_TARIFF_REVIEW.md +33 -0
- package/docs/reports/unified-9.0.18/GERAETE_EMS_EINRICHTUNG.md +86 -0
- package/docs/reports/unified-9.0.18/INSTALLER_LIFECYCLE_REVIEW.md +29 -0
- package/docs/reports/unified-9.0.18/KUNDENTARIF_EINRICHTUNG.md +27 -0
- package/docs/reports/unified-9.0.18/PRUEFBERICHT.md +87 -0
- package/docs/reports/unified-9.0.18/UNABHAENGIGER_REVIEW.md +63 -0
- package/docs/reports/unified-9.0.18/raw/INDEX.json +331 -0
- package/docs/reports/unified-9.0.18/raw/audit-full.log +345 -0
- package/docs/reports/unified-9.0.18/raw/audit-full.result.json +14 -0
- package/docs/reports/unified-9.0.18/raw/audit-runtime.log +23 -0
- package/docs/reports/unified-9.0.18/raw/audit-runtime.result.json +15 -0
- package/docs/reports/unified-9.0.18/raw/backend-final.log +5 -0
- package/docs/reports/unified-9.0.18/raw/backend-final.result.json +14 -0
- package/docs/reports/unified-9.0.18/raw/frontend-build.log +152 -0
- package/docs/reports/unified-9.0.18/raw/frontend-build.result.json +14 -0
- package/docs/reports/unified-9.0.18/raw/installer-build.log +26 -0
- package/docs/reports/unified-9.0.18/raw/installer-build.result.json +14 -0
- package/docs/reports/unified-9.0.18/raw/keygen-source.json +6 -0
- package/docs/reports/unified-9.0.18/raw/lint-final.log +5 -0
- package/docs/reports/unified-9.0.18/raw/lint-final.result.json +14 -0
- package/docs/reports/unified-9.0.18/raw/modules-build.log +5 -0
- package/docs/reports/unified-9.0.18/raw/modules-build.result.json +14 -0
- package/docs/reports/unified-9.0.18/raw/node22-tests-final.log +9859 -0
- package/docs/reports/unified-9.0.18/raw/node22-tests-final.result.json +13 -0
- package/docs/reports/unified-9.0.18/raw/node22-typecheck-final.log +7 -0
- package/docs/reports/unified-9.0.18/raw/node22-typecheck-final.result.json +14 -0
- package/docs/reports/unified-9.0.18/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.18/raw/node24-tests-final.log +1663 -0
- package/docs/reports/unified-9.0.18/raw/node24-tests-final.result.json +13 -0
- package/docs/reports/unified-9.0.18/raw/node24-typecheck-final.log +5 -0
- package/docs/reports/unified-9.0.18/raw/node24-typecheck-final.result.json +14 -0
- package/docs/reports/unified-9.0.18/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.18/raw/sbom-runtime.log +7 -0
- package/docs/reports/unified-9.0.18/raw/sbom-runtime.result.json +14 -0
- package/docs/reports/unified-9.0.18/raw/sbom-vendor-check.log +1 -0
- package/docs/reports/unified-9.0.18/raw/sbom-vendor-check.result.json +14 -0
- package/docs/reports/unified-9.0.18/raw/ui-docs-check.log +6 -0
- package/docs/reports/unified-9.0.18/raw/ui-docs-check.result.json +14 -0
- package/docs/reports/unified-9.0.18/raw/ui-runtime-final.log +7 -0
- package/docs/reports/unified-9.0.18/raw/ui-runtime-final.result.json +14 -0
- package/docs/reports/unified-9.0.18/raw/ui-runtime-sync.log +6 -0
- package/docs/reports/unified-9.0.18/raw/ui-runtime-sync.result.json +14 -0
- package/docs/reports/unified-9.0.18/raw/ui-sbom-check.log +6 -0
- package/docs/reports/unified-9.0.18/raw/ui-sbom-check.result.json +14 -0
- package/docs/reports/unified-9.0.18/raw/ui-sbom-final.log +14 -0
- package/docs/reports/unified-9.0.18/raw/ui-sbom-final.result.json +14 -0
- package/docs/reports/unified-9.0.18/raw/ui-secret-final.log +6 -0
- package/docs/reports/unified-9.0.18/raw/ui-secret-final.result.json +14 -0
- package/docs/reports/unified-9.0.18/raw/ui-security-final.log +8 -0
- package/docs/reports/unified-9.0.18/raw/ui-security-final.result.json +14 -0
- package/io-package.json +8 -8
- package/modules/devices/admin/alias-contract-v1.json +189 -0
- package/modules/devices/admin/ems-assignment.d.ts +10 -0
- package/modules/devices/admin/ems-assignment.js +194 -0
- package/modules/devices/admin/host-bridge.js +47 -0
- package/modules/devices/admin/index.html +19 -1
- package/modules/devices/admin/index_m.js +73 -1
- package/modules/devices/admin/style.css +15 -0
- package/modules/devices/checks/emsAssignment.check.js +128 -0
- package/modules/devices/eslint.hosted.config.mjs +1 -1
- package/modules/devices/index.js +11 -0
- package/modules/devices/lib/alias-contract-v1.json +189 -0
- package/modules/devices/lib/aliasContract.js +7 -1
- package/modules/devices/lib/device-alias-semantics-v1.json +1605 -0
- package/modules/devices/lib/deviceAliasSemantics.js +109 -0
- package/modules/devices/lib/deviceRuntime.js +3 -0
- package/modules/devices/test/aliasContractV1.test.js +1 -1
- package/modules/devices/test/deviceAliasSemantics.test.js +163 -0
- package/modules/devices/test/emsAssignmentUi.test.js +190 -0
- package/modules/devices/tsconfig.alias-semantics.json +17 -0
- package/modules/devices/tsconfig.ems-ui.json +9 -0
- package/package.json +9 -7
- package/release-manifests/unified/build-environment.cdx.json +6 -6
- package/release-manifests/unified/files.json +194 -85
- package/release-manifests/unified/frontend.cdx.json +6 -6
- package/release-manifests/unified/installer.cdx.json +6 -6
- package/release-manifests/unified/obsolete-admin-assets.json +84 -0
- package/release-manifests/unified/runtime.cdx.json +23 -23
- package/release-manifests/unified/validation.json +15 -15
- package/tools/eos-release-check.cjs +1 -1
- package/tools/eos-release-manifest.cjs +5 -5
- package/ui/docs/security/eslint-reviewed-findings.json +32 -18
- package/ui/ems/datapoints.js +22 -1
- package/ui/ems/modules/tariff-provider.js +232 -54
- package/ui/io-package.json +5 -1
- package/ui/lib/customer-tariff.js +241 -0
- package/ui/lib/installer-lifecycle.js +87 -0
- package/ui/main.js +203 -117
- package/ui/package.json +8 -4
- package/ui/www/customer-tariff.css +21 -0
- package/ui/www/customer-tariff.js +333 -0
- package/ui/www/ems-apps.js +16 -6
- package/ui/www/manifest.webmanifest +2 -2
- package/ui/www/settings.html +45 -0
- package/adminWww/remoteEntry-eos-9.0.17.js +0 -12
package/ui/main.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* AUTO-GENERATED RUNTIME FILE - NICHT MANUELL BEARBEITEN.
|
|
8
8
|
*
|
|
9
9
|
* Quelle: src-ts/runtime-executables/main.ts
|
|
10
|
-
* Quell-Hash: sha256:
|
|
10
|
+
* Quell-Hash: sha256:bb4b5124812500e994c188d439c7a8137acebc9cbb593c38b109e74134995d18
|
|
11
11
|
* Erzeugung: npm run sync:ts-runtime-executables
|
|
12
12
|
*
|
|
13
13
|
* Zweck:
|
|
@@ -54,6 +54,8 @@ const os = require('os');
|
|
|
54
54
|
// JSON bleibt unkomprimiert: inflate:false verhindert Dekompressionsfehler auch mit älteren ioBroker-Abhängigkeitsbäumen.
|
|
55
55
|
const bodyParser = express.json({ limit: '5mb', inflate: false });
|
|
56
56
|
const crypto = require('crypto');
|
|
57
|
+
const { installerRevision, assertInstallerRevision, provisionInstallerObjects } = require('./lib/installer-lifecycle');
|
|
58
|
+
const { customerTariffView, prepareCustomerTariffChange } = require('./lib/customer-tariff');
|
|
57
59
|
const https = require('https');
|
|
58
60
|
const pkg = require('./package.json');
|
|
59
61
|
const { defaultEnergyOriginConfig, registerEnergyOriginApi } = require('./lib/energy-origin-api');
|
|
@@ -3350,6 +3352,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
3350
3352
|
'settingsConfig',
|
|
3351
3353
|
'datapoints',
|
|
3352
3354
|
'installerConfig',
|
|
3355
|
+
'eosDeviceEms', // Server-owned commissioning identities survive updates and app changes.
|
|
3353
3356
|
'countryProfile',
|
|
3354
3357
|
'emsApps',
|
|
3355
3358
|
'schedulerIntervalMs',
|
|
@@ -4843,6 +4846,100 @@ class NexoWattVis extends HostedAdapter {
|
|
|
4843
4846
|
}
|
|
4844
4847
|
}
|
|
4845
4848
|
|
|
4849
|
+
_nwInstallerConfigRevision() {
|
|
4850
|
+
return installerRevision(this._nwInstallerConfigPatch || {});
|
|
4851
|
+
}
|
|
4852
|
+
|
|
4853
|
+
_nwAssertInstallerConfigRevision(expected) {
|
|
4854
|
+
assertInstallerRevision(expected, this._nwInstallerConfigPatch || {});
|
|
4855
|
+
}
|
|
4856
|
+
|
|
4857
|
+
async _nwProvisionInstallerObjects(nextConfig) {
|
|
4858
|
+
const rows = nextConfig?.settingsConfig?.evcsList;
|
|
4859
|
+
const count = Math.max(Array.isArray(rows) ? rows.length : 0, Number(nextConfig?.settingsConfig?.evcsCount) || 0);
|
|
4860
|
+
await provisionInstallerObjects({
|
|
4861
|
+
canWrite: () => !this._nwShuttingDown && this._bridge.canWrite() === true,
|
|
4862
|
+
steps: [() => this.ensureInstallerStates(), () => this.ensureSettingsStates(),
|
|
4863
|
+
() => this.ensureStorageFarmStates(), () => this.ensureEvcsStates(Math.min(50, Math.max(0, Math.round(count)))),
|
|
4864
|
+
() => this.ensureRfidStates(true)],
|
|
4865
|
+
});
|
|
4866
|
+
}
|
|
4867
|
+
|
|
4868
|
+
async _nwApplyInstallerRuntime(restartEms, reason) {
|
|
4869
|
+
const currentTariffModule = this.emsEngine?.mm?.modules?.find(entry => entry.key === 'tariffProvider')?.instance;
|
|
4870
|
+
if (currentTariffModule && typeof currentTariffModule.invalidateConfiguration === 'function') await currentTariffModule.invalidateConfiguration();
|
|
4871
|
+
if (currentTariffModule && typeof currentTariffModule.applyTariffMappings === 'function') await currentTariffModule.applyTariffMappings();
|
|
4872
|
+
await this._nwProvisionInstallerObjects(this.config);
|
|
4873
|
+
await this.syncInstallerConfigToStates();
|
|
4874
|
+
await this.syncSettingsToStates(reason === 'device-commissioning');
|
|
4875
|
+
await this.syncSettingsConfigToStates();
|
|
4876
|
+
await this.ensureEvcsStates();
|
|
4877
|
+
await this.subscribeEvcsMappedStates();
|
|
4878
|
+
await this.subscribeConfiguredStates();
|
|
4879
|
+
await this.ensureHistorieExportStates();
|
|
4880
|
+
if (this._nwHistoryApiCache instanceof Map) this._nwHistoryApiCache.clear();
|
|
4881
|
+
// In-flight history requests retain their existing deduplication/lifecycle fencing.
|
|
4882
|
+
this.startHistorieExportTimer();
|
|
4883
|
+
await this.syncStorageFarmConfigFromAdmin();
|
|
4884
|
+
if (this._nwStorageFarmTimer) {
|
|
4885
|
+
this._nwClearInterval(this._nwStorageFarmTimer);
|
|
4886
|
+
this._nwStorageFarmTimer = null;
|
|
4887
|
+
}
|
|
4888
|
+
if (this._nwGetStorageFarmRuntimeInfo().active) {
|
|
4889
|
+
const interval = Math.max(250, Math.min(1000, Math.round(Number(this.config?.storageFarm?.schedulerIntervalMs) || 1000)));
|
|
4890
|
+
await this.updateStorageFarmDerived(reason);
|
|
4891
|
+
this._nwStorageFarmTimer = this._nwSetInterval(() => { this.updateStorageFarmDerived('timer').catch(() => {}); }, interval);
|
|
4892
|
+
}
|
|
4893
|
+
if (restartEms) {
|
|
4894
|
+
try { await this.initEmsEngine(true); }
|
|
4895
|
+
catch (_error) {
|
|
4896
|
+
throw createPublicHttpError(503, 'EOS_EMS_APPLY_FAILED', 'Einstellungen sind gespeichert. Die EMS-Laufzeit konnte sie noch nicht übernehmen; Status prüfen und erneut anwenden.');
|
|
4897
|
+
}
|
|
4898
|
+
}
|
|
4899
|
+
await this._meshCoordinator?.syncAppLifecycle();
|
|
4900
|
+
}
|
|
4901
|
+
|
|
4902
|
+
/** Automatic aliases are planned under the same lock as manual AppCenter saves.
|
|
4903
|
+
* Only configuration and missing own objects change; no app/control permission is enabled. */
|
|
4904
|
+
async reconcileDeviceEms(devices) {
|
|
4905
|
+
const assertReady = () => {
|
|
4906
|
+
if (this._nwShuttingDown || this._bridge.canWrite() !== true) throw new Error('EOS_UI_OWNERSHIP_REQUIRED');
|
|
4907
|
+
if (!['ready', 'degraded'].includes(this._hostedStartup?.state)) throw new Error('EOS_UI_STARTING');
|
|
4908
|
+
if (!centralLicenseSnapshot(this._bridge).ok) throw new Error('EOS_LICENSE_REQUIRED');
|
|
4909
|
+
};
|
|
4910
|
+
assertReady();
|
|
4911
|
+
const token = this._nwBeginInstallerConfigMutation();
|
|
4912
|
+
if (!token) throw new Error('EOS_DEVICE_EMS_BUSY');
|
|
4913
|
+
try {
|
|
4914
|
+
assertReady();
|
|
4915
|
+
if (typeof this._bridge.deviceEmsPlan !== 'function') throw new Error('EOS_DEVICE_EMS_UNAVAILABLE');
|
|
4916
|
+
const effective = this.nwApplyInstallerPatchToRuntimeConfig(this.config || {}, this._nwInstallerConfigPatch || {});
|
|
4917
|
+
const plan = await this._bridge.deviceEmsPlan({ config: effective, devices });
|
|
4918
|
+
assertReady();
|
|
4919
|
+
if (!plan.changed && !this._nwDeviceEmsApplyPending) return { changed: false, statuses: plan.statuses };
|
|
4920
|
+
const patch = this.nwDeepMerge(this._nwDeepClone(this._nwInstallerConfigPatch || {}), plan.patch);
|
|
4921
|
+
if (plan.changed) {
|
|
4922
|
+
await prepareDynamicGridInstallerPatch(this, patch, plan.patch, currentDynamicGridConfig(this).configVersion);
|
|
4923
|
+
}
|
|
4924
|
+
const next = this.nwApplyInstallerPatchToRuntimeConfig(this.config || {}, patch);
|
|
4925
|
+
await this._nwProvisionInstallerObjects(next);
|
|
4926
|
+
assertReady();
|
|
4927
|
+
if (plan.changed) {
|
|
4928
|
+
if (await this.persistInstallerConfigToState(patch) === false) throw new Error('EOS_DEVICE_EMS_PERSIST_FAILED');
|
|
4929
|
+
this._nwInstallerConfigPatch = patch;
|
|
4930
|
+
this._nwInstallerConfigRawPatch = this._nwDeepClone(patch);
|
|
4931
|
+
}
|
|
4932
|
+
this._nwDeviceEmsApplyPending = true;
|
|
4933
|
+
assertReady();
|
|
4934
|
+
this.config = next;
|
|
4935
|
+
await this._nwApplyInstallerRuntime(true, 'device-commissioning');
|
|
4936
|
+
this._nwDeviceEmsApplyPending = false;
|
|
4937
|
+
try { await this.nwWriteUserdataBackup(patch, 'device-commissioning'); }
|
|
4938
|
+
catch (_error) { this.log.warn('EOS_DEVICE_EMS_BACKUP_FAILED: Einstellungen gespeichert; zusätzliche Sicherung fehlgeschlagen.'); }
|
|
4939
|
+
return { changed: plan.changed, statuses: plan.statuses };
|
|
4940
|
+
} finally { this._nwEndInstallerConfigMutation(token); }
|
|
4941
|
+
}
|
|
4942
|
+
|
|
4846
4943
|
async persistInstallerConfigToState(patchObj) {
|
|
4847
4944
|
// Auch interne Save-/Importpfade dürfen verbindliche Mesh-Grenzen nicht lösen.
|
|
4848
4945
|
const nextRuntime = this.nwApplyInstallerPatchToRuntimeConfig(this.config, patchObj);
|
|
@@ -9237,8 +9334,8 @@ class NexoWattVis extends HostedAdapter {
|
|
|
9237
9334
|
* Zusammenhang: Teil von Adapterkern: Lifecycle, Webserver, API, States, EMS-Engine; Aufrufstellen und abhängige States/APIs beim Ändern mitprüfen.
|
|
9238
9335
|
* TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
|
|
9239
9336
|
*/
|
|
9240
|
-
async ensureEvcsStates() {
|
|
9241
|
-
const count = Math.max(0, Math.round(Number(this.evcsCount
|
|
9337
|
+
async ensureEvcsStates(provisionCount) {
|
|
9338
|
+
const count = Math.max(0, Math.round(Number(provisionCount === undefined ? this.evcsCount : provisionCount) || 0));
|
|
9242
9339
|
|
|
9243
9340
|
await this.setObjectNotExistsAsync('evcs', {
|
|
9244
9341
|
type: 'channel',
|
|
@@ -9322,7 +9419,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
9322
9419
|
|
|
9323
9420
|
// write static names/notes from config into local states
|
|
9324
9421
|
try {
|
|
9325
|
-
if (Array.isArray(this.evcsList)) {
|
|
9422
|
+
if (provisionCount === undefined && Array.isArray(this.evcsList)) {
|
|
9326
9423
|
for (const wb of this.evcsList) {
|
|
9327
9424
|
await this.setStateAsync(`evcs.${wb.index}.name`, wb.name, true);
|
|
9328
9425
|
await this.setStateAsync(`evcs.${wb.index}.note`, wb.note || '', true);
|
|
@@ -9338,7 +9435,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
9338
9435
|
* Zusammenhang: Teil von Adapterkern: Lifecycle, Webserver, API, States, EMS-Engine; Aufrufstellen und abhängige States/APIs beim Ändern mitprüfen.
|
|
9339
9436
|
* TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
|
|
9340
9437
|
*/
|
|
9341
|
-
async ensureRfidStates() {
|
|
9438
|
+
async ensureRfidStates(provisionOnly = false) {
|
|
9342
9439
|
// Base RFID states for EVCS access control (Whitelist + Learning)
|
|
9343
9440
|
await this.setObjectNotExistsAsync('evcs.rfid', {
|
|
9344
9441
|
type: 'channel',
|
|
@@ -9412,9 +9509,10 @@ class NexoWattVis extends HostedAdapter {
|
|
|
9412
9509
|
});
|
|
9413
9510
|
}
|
|
9414
9511
|
|
|
9415
|
-
|
|
9512
|
+
if (provisionOnly) return;
|
|
9513
|
+
// A database read failure must never replace an existing customer whitelist.
|
|
9416
9514
|
for (const [id, c] of Object.entries(defs)) {
|
|
9417
|
-
const st = await this.getStateAsync(id)
|
|
9515
|
+
const st = await this.getStateAsync(id);
|
|
9418
9516
|
if (!st || st.val === undefined || st.val === null) {
|
|
9419
9517
|
await this.setStateAsync(id, c.def, true);
|
|
9420
9518
|
}
|
|
@@ -11759,9 +11857,8 @@ async onReady() {
|
|
|
11759
11857
|
this.log.debug('Live core refresh init failed: ' + (e && e.message ? e.message : e));
|
|
11760
11858
|
}
|
|
11761
11859
|
|
|
11762
|
-
//
|
|
11763
|
-
//
|
|
11764
|
-
try { await startupStep(() => this.cleanupOrphanedObjects()); } catch (_e) {}
|
|
11860
|
+
// Persisted device/history objects remain available when an app or device is disabled.
|
|
11861
|
+
// Removal requires an explicit maintenance operation, never startup/update.
|
|
11765
11862
|
|
|
11766
11863
|
// Energy totals: if no kWh counters are mapped, derive totals from history/influxdb
|
|
11767
11864
|
this._hostedStartupPhase = 'history';
|
|
@@ -11792,6 +11889,7 @@ async onReady() {
|
|
|
11792
11889
|
if (this._nwShuttingDown) return;
|
|
11793
11890
|
assertStartupAuthority();
|
|
11794
11891
|
this._hostedStartup = { state: this.emsEngine ? 'ready' : 'degraded', error: this.emsEngine ? '' : 'EOS_EMS_INIT_FAILED' };
|
|
11892
|
+
this._bridge.deviceEmsConfigChanged?.();
|
|
11795
11893
|
if (this.emsEngine) this.log.info('NexoWatt EOS ist bereit.');
|
|
11796
11894
|
else this.log.warn('EOS_EMS_INIT_FAILED: Bedienoberfläche verfügbar, Betriebsstart unvollständig.');
|
|
11797
11895
|
} catch (e) {
|
|
@@ -15625,6 +15723,7 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
15625
15723
|
const _nwTariffSecretKeys = new Set(['accessToken','securityToken','clientSecret','bearerToken','apiKey','password','refreshToken']);
|
|
15626
15724
|
const _nwMaskTariffProviderForUi = (cfg) => {
|
|
15627
15725
|
const clone = this._nwDeepClone(cfg || {}) || {};
|
|
15726
|
+
if (clone?.tariffProvider) delete clone.tariffProvider.retainedProviderCredentials;
|
|
15628
15727
|
const creds = clone && clone.tariffProvider && clone.tariffProvider.credentials;
|
|
15629
15728
|
if (creds && typeof creds === 'object') {
|
|
15630
15729
|
for (const key of Object.keys(creds)) {
|
|
@@ -15633,6 +15732,11 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
15633
15732
|
}
|
|
15634
15733
|
return clone;
|
|
15635
15734
|
};
|
|
15735
|
+
const stripRetainedTariffCredentials = (patch) => {
|
|
15736
|
+
const clean = this._nwDeepClone(patch || {}) || {};
|
|
15737
|
+
if (clean.tariffProvider) delete clean.tariffProvider.retainedProviderCredentials;
|
|
15738
|
+
return clean;
|
|
15739
|
+
};
|
|
15636
15740
|
const _nwMergeTariffProviderSecrets = (incoming, existing) => {
|
|
15637
15741
|
const next = this._nwDeepClone(incoming || {}) || {};
|
|
15638
15742
|
const prev = existing && typeof existing === 'object' ? existing : {};
|
|
@@ -15676,6 +15780,7 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
15676
15780
|
app.get('/api/installer/config', requireInstaller, async (_req, res) => {
|
|
15677
15781
|
try {
|
|
15678
15782
|
sendNoStore(res);
|
|
15783
|
+
const configurationRevision = this._nwInstallerConfigRevision();
|
|
15679
15784
|
// A license can be saved through the Admin tab while the App-Center is already open.
|
|
15680
15785
|
// Refresh the runtime license cache here before filtering apps. This also covers the
|
|
15681
15786
|
// startup edge case where the HTTP gate is open but _nwLicenseInfo has not yet been
|
|
@@ -15702,7 +15807,7 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
15702
15807
|
cfgOut.locale = this._nwBuildLocaleInfo();
|
|
15703
15808
|
cfgOut.countryProfile = Object.assign({}, cfgOut.countryProfile || {}, this._nwBuildCountryProfileInfo());
|
|
15704
15809
|
cfgOut.regressionSafety = this._nwInstallerRegressionSafetyLastReport || { schema: 'nexowatt.installer-regression-safety.v1', ok: true, checks: [] };
|
|
15705
|
-
res.json({ ok: true, license: cfgOut.license, config: cfgOut });
|
|
15810
|
+
res.json({ ok: true, license: cfgOut.license, config: cfgOut, configurationRevision });
|
|
15706
15811
|
} catch (e) {
|
|
15707
15812
|
this.log.warn('Installer config API error: ' + e.message);
|
|
15708
15813
|
res.status(500).json({ ok: false, error: 'internal error' });
|
|
@@ -15716,6 +15821,7 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
15716
15821
|
try {
|
|
15717
15822
|
sendNoStore(res);
|
|
15718
15823
|
const body = req.body || {};
|
|
15824
|
+
this._nwAssertInstallerConfigRevision(body.expectedConfigurationRevision);
|
|
15719
15825
|
const patch = body.patch && typeof body.patch === 'object' ? body.patch : {};
|
|
15720
15826
|
const restartEms = body.restartEms !== false; // default true
|
|
15721
15827
|
const tokenError = nwValidateStationTokenChanges(patch);
|
|
@@ -15862,6 +15968,7 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
15862
15968
|
try { this._meshCoordinator?.assertAppChange(this.nwApplyInstallerPatchToRuntimeConfig(this.config, mergedPatch)); }
|
|
15863
15969
|
catch (error) { const failure = safeConfigurationFailure(error); return res.status(failure.status).json(failure.body); }
|
|
15864
15970
|
// Persist patch to states (no ioBroker restart)
|
|
15971
|
+
await this._nwProvisionInstallerObjects(this.nwApplyInstallerPatchToRuntimeConfig(this.config, mergedPatch));
|
|
15865
15972
|
if (await this.persistInstallerConfigToState(mergedPatch) === false) throw new Error('Installer-Konfiguration konnte nicht gespeichert werden.');
|
|
15866
15973
|
this._nwInstallerConfigPatch = mergedPatch;
|
|
15867
15974
|
|
|
@@ -15871,63 +15978,7 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
15871
15978
|
// Apply patch to runtime config (App-Center SoT: replace installer-managed sections)
|
|
15872
15979
|
this.config = (this.config && typeof this.config === 'object') ? this.config : {};
|
|
15873
15980
|
this.config = this.nwApplyInstallerPatchToRuntimeConfig(this.config, mergedPatch);
|
|
15874
|
-
await this.
|
|
15875
|
-
|
|
15876
|
-
// Apply updated VIS/EVCS configuration to runtime (best-effort)
|
|
15877
|
-
|
|
15878
|
-
try { await this.syncInstallerConfigToStates(); } catch (_e) {}
|
|
15879
|
-
try { await this.syncSettingsToStates(); } catch (_e) {}
|
|
15880
|
-
try { await this.syncSettingsConfigToStates(); } catch (_e) {}
|
|
15881
|
-
try { await this.ensureEvcsStates(); } catch (_e) {}
|
|
15882
|
-
try { await this.ensureRfidStates(); } catch (_e) {}
|
|
15883
|
-
try { await this.subscribeEvcsMappedStates(); } catch (_e) {}
|
|
15884
|
-
|
|
15885
|
-
// Re-subscribe to mapped states so the VIS immediately sees fresh values
|
|
15886
|
-
try {
|
|
15887
|
-
if (typeof this.subscribeConfiguredStates === 'function') {
|
|
15888
|
-
await this.subscribeConfiguredStates();
|
|
15889
|
-
}
|
|
15890
|
-
} catch (_e) {}
|
|
15891
|
-
|
|
15892
|
-
// Historie/Influx: when optional Verbraucher/Erzeuger are added in the App-Center,
|
|
15893
|
-
// create the canonical nexowatt-ui.0.historie.* states immediately. Previously this
|
|
15894
|
-
// only happened on adapter startup, so newly connected producer slots appeared in
|
|
15895
|
-
// the History UI but had no object/influx binding until a restart.
|
|
15896
|
-
try {
|
|
15897
|
-
if (this._nwHistoryApiCache instanceof Map) this._nwHistoryApiCache.clear();
|
|
15898
|
-
if (this._nwHistoryApiInflight instanceof Map) this._nwHistoryApiInflight.clear();
|
|
15899
|
-
await this.ensureHistorieExportStates();
|
|
15900
|
-
await this.updateHistorieExportStates('config-save');
|
|
15901
|
-
this.startHistorieExportTimer();
|
|
15902
|
-
} catch (e) {
|
|
15903
|
-
try { this.log.debug('Historie refresh after config save failed: ' + (e && e.message ? e.message : e)); } catch (_e2) {}
|
|
15904
|
-
}
|
|
15905
|
-
|
|
15906
|
-
// StorageFarm: derived status + scheduler in sync after installer save
|
|
15907
|
-
try { await this.ensureStorageFarmStates(); } catch (_e) {}
|
|
15908
|
-
try { await this.syncStorageFarmDefaultsToStates(); } catch (_e) {}
|
|
15909
|
-
try { await this.syncStorageFarmConfigFromAdmin(); } catch (_e) {}
|
|
15910
|
-
try {
|
|
15911
|
-
if (this._nwStorageFarmTimer) {
|
|
15912
|
-
this._nwClearInterval(this._nwStorageFarmTimer);
|
|
15913
|
-
this._nwStorageFarmTimer = null;
|
|
15914
|
-
}
|
|
15915
|
-
|
|
15916
|
-
const enabledSf = !!this._nwGetStorageFarmRuntimeInfo().active;
|
|
15917
|
-
const sfCfg = (this.config && this.config.storageFarm && typeof this.config.storageFarm === 'object') ? this.config.storageFarm : {};
|
|
15918
|
-
const interval = (sfCfg.schedulerIntervalMs !== undefined && sfCfg.schedulerIntervalMs !== null && Number.isFinite(Number(sfCfg.schedulerIntervalMs)))
|
|
15919
|
-
? Math.max(250, Math.min(1000, Math.round(Number(sfCfg.schedulerIntervalMs))))
|
|
15920
|
-
: 1000;
|
|
15921
|
-
|
|
15922
|
-
if (enabledSf) {
|
|
15923
|
-
await this.updateStorageFarmDerived('config-save');
|
|
15924
|
-
this._nwStorageFarmTimer = this._nwSetInterval(() => { this.updateStorageFarmDerived('timer').catch(() => {}); }, interval);
|
|
15925
|
-
}
|
|
15926
|
-
} catch (_e) {}
|
|
15927
|
-
|
|
15928
|
-
if (restartEms) {
|
|
15929
|
-
await _nwRestartEms();
|
|
15930
|
-
}
|
|
15981
|
+
await this._nwApplyInstallerRuntime(restartEms, 'config-save');
|
|
15931
15982
|
|
|
15932
15983
|
try { await this._nwInitLicense(); } catch (e) { try { this.log.warn('License refresh after installer config save failed: ' + (e && e.message ? e.message : e)); } catch (_eLog) {} }
|
|
15933
15984
|
let cfgOut = await _nwHydrateStorageFarmConfigFromRuntimeStates(_nwPickPersistedInstallerConfig());
|
|
@@ -15943,7 +15994,8 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
15943
15994
|
cfgOut.license = this._nwBuildLicenseFeatureInfo();
|
|
15944
15995
|
cfgOut.locale = this._nwBuildLocaleInfo();
|
|
15945
15996
|
cfgOut.countryProfile = Object.assign({}, cfgOut.countryProfile || {}, this._nwBuildCountryProfileInfo());
|
|
15946
|
-
res.json({ ok: true, license: cfgOut.license, config: cfgOut, restarted: !!restartEms });
|
|
15997
|
+
res.json({ ok: true, license: cfgOut.license, config: cfgOut, restarted: !!restartEms, configurationRevision: this._nwInstallerConfigRevision() });
|
|
15998
|
+
this._bridge.deviceEmsConfigChanged?.();
|
|
15947
15999
|
} catch (e) {
|
|
15948
16000
|
this.log.warn('Installer config save API error: ' + safeConfigurationFailure(e).body.error);
|
|
15949
16001
|
// Send a concise message to the frontend to avoid "Speichern fehlgeschlagen" without context.
|
|
@@ -15966,7 +16018,7 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
15966
16018
|
adapter: 'nexowatt-ui',
|
|
15967
16019
|
adapterVersion: (pkg && pkg.version) ? String(pkg.version) : '',
|
|
15968
16020
|
instance: this.instance,
|
|
15969
|
-
configPatch: patch,
|
|
16021
|
+
configPatch: stripRetainedTariffCredentials(patch),
|
|
15970
16022
|
};
|
|
15971
16023
|
res.json({ ok: true, backup });
|
|
15972
16024
|
} catch (e) {
|
|
@@ -15998,7 +16050,7 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
15998
16050
|
reason: backup.reason || '',
|
|
15999
16051
|
bytes,
|
|
16000
16052
|
},
|
|
16001
|
-
backup,
|
|
16053
|
+
backup: { ...backup, configPatch: stripRetainedTariffCredentials(backup.configPatch) },
|
|
16002
16054
|
});
|
|
16003
16055
|
} catch (e) {
|
|
16004
16056
|
const msg = (e && e.message) ? String(e.message) : 'internal error';
|
|
@@ -16012,6 +16064,7 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
16012
16064
|
if (!meshSaveToken) return res.status(409).json({ error: 'Konfiguration wird bereits gespeichert.' });
|
|
16013
16065
|
try {
|
|
16014
16066
|
const body = req.body || {};
|
|
16067
|
+
this._nwAssertInstallerConfigRevision(body.expectedConfigurationRevision);
|
|
16015
16068
|
const restartEms = body.restartEms !== false; // default true
|
|
16016
16069
|
const mode = String(body.mode || 'replace').toLowerCase(); // replace | merge
|
|
16017
16070
|
|
|
@@ -16115,52 +16168,17 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
16115
16168
|
if (!storageLicenseValidation.ok) return res.status(400).json(storageLicenseValidation);
|
|
16116
16169
|
try { this._meshCoordinator?.assertAppChange(this.nwApplyInstallerPatchToRuntimeConfig(baseNative, finalPatch)); }
|
|
16117
16170
|
catch (error) { const failure = safeConfigurationFailure(error); return res.status(failure.status).json(failure.body); }
|
|
16171
|
+
await this._nwProvisionInstallerObjects(this.nwApplyInstallerPatchToRuntimeConfig(baseNative, finalPatch));
|
|
16118
16172
|
if (await this.persistInstallerConfigToState(finalPatch) === false) throw new Error('Installer-Import konnte nicht gespeichert werden.');
|
|
16119
16173
|
this._nwInstallerConfigPatch = finalPatch;
|
|
16120
16174
|
|
|
16121
16175
|
// Apply patch as SoT (replace installer-managed sections)
|
|
16122
16176
|
this.config = this.nwApplyInstallerPatchToRuntimeConfig(baseNative, finalPatch);
|
|
16123
|
-
await this.
|
|
16124
|
-
|
|
16125
|
-
// Apply updated config to runtime (best-effort)
|
|
16126
|
-
try { await this.syncInstallerConfigToStates(); } catch (_e) {}
|
|
16127
|
-
try { await this.syncSettingsToStates(); } catch (_e) {}
|
|
16128
|
-
try { await this.syncSettingsConfigToStates(); } catch (_e) {}
|
|
16129
|
-
try { await this.ensureEvcsStates(); } catch (_e) {}
|
|
16130
|
-
try { await this.ensureRfidStates(); } catch (_e) {}
|
|
16131
|
-
try { await this.subscribeEvcsMappedStates(); } catch (_e) {}
|
|
16132
|
-
|
|
16133
|
-
// Re-subscribe to mapped states so the VIS immediately sees fresh values
|
|
16134
|
-
try {
|
|
16135
|
-
if (typeof this.subscribeConfiguredStates === 'function') {
|
|
16136
|
-
await this.subscribeConfiguredStates();
|
|
16137
|
-
}
|
|
16138
|
-
} catch (_e) {}
|
|
16139
|
-
|
|
16140
|
-
// Historie/Influx: provision canonical optional series immediately after import.
|
|
16141
|
-
try {
|
|
16142
|
-
if (this._nwHistoryApiCache instanceof Map) this._nwHistoryApiCache.clear();
|
|
16143
|
-
if (this._nwHistoryApiInflight instanceof Map) this._nwHistoryApiInflight.clear();
|
|
16144
|
-
await this.ensureHistorieExportStates();
|
|
16145
|
-
await this.updateHistorieExportStates('import');
|
|
16146
|
-
this.startHistorieExportTimer();
|
|
16147
|
-
} catch (e) {
|
|
16148
|
-
try { this.log.debug('Historie refresh after import failed: ' + (e && e.message ? e.message : e)); } catch (_e2) {}
|
|
16149
|
-
}
|
|
16150
|
-
|
|
16151
|
-
// StorageFarm: derived status + scheduler in sync after import
|
|
16152
|
-
try { await this.ensureStorageFarmStates(); } catch (_e) {}
|
|
16153
|
-
try { await this.syncStorageFarmDefaultsToStates(); } catch (_e) {}
|
|
16154
|
-
try { await this.syncStorageFarmConfigFromAdmin(); } catch (_e) {}
|
|
16155
|
-
|
|
16156
|
-
// Persist uninstall-proof backup
|
|
16177
|
+
await this._nwApplyInstallerRuntime(restartEms, 'import');
|
|
16157
16178
|
try { await this.nwWriteUserdataBackup(finalPatch, 'import'); } catch (_e) {}
|
|
16158
16179
|
|
|
16159
|
-
|
|
16160
|
-
|
|
16161
|
-
}
|
|
16162
|
-
|
|
16163
|
-
res.json({ ok: true, imported: true, restarted: !!restartEms, config: _nwPickPersistedInstallerConfig() });
|
|
16180
|
+
res.json({ ok: true, imported: true, restarted: !!restartEms, config: _nwPickPersistedInstallerConfig(), configurationRevision: this._nwInstallerConfigRevision() });
|
|
16181
|
+
this._bridge.deviceEmsConfigChanged?.();
|
|
16164
16182
|
} catch (e) {
|
|
16165
16183
|
const failure = safeConfigurationFailure(e);
|
|
16166
16184
|
res.status(failure.status).json(failure.body);
|
|
@@ -16867,6 +16885,64 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
16867
16885
|
// auto-fill App-Center mappings (EVCS / PV‑Regelung / Thermik / §14a).
|
|
16868
16886
|
//
|
|
16869
16887
|
// IMPORTANT: This endpoint only discovers; it never writes config.
|
|
16888
|
+
// Der Kundentarif gilt für die gesamte Anlage. Der Kunde kann ausschließlich
|
|
16889
|
+
// Anbieter/Vertragswerte wählen; Anlagenfreigaben und freie DP-Pfade bleiben geschützt.
|
|
16890
|
+
const requireCustomerTariff = async (req, res, next) => {
|
|
16891
|
+
if (!['customer', 'installer', 'admin'].includes(req.nwSession?.role)) return res.status(403).json({ ok: false, error: 'forbidden' });
|
|
16892
|
+
if (!this._nwIsFeatureLicensed('dynamicTariffs')) return res.status(403).json({ ok: false, error: 'EOS_TARIFF_LICENSE_REQUIRED' });
|
|
16893
|
+
return next();
|
|
16894
|
+
};
|
|
16895
|
+
const customerTariffSnapshot = () => {
|
|
16896
|
+
const root = this.nwApplyInstallerPatchToRuntimeConfig(this.config || {}, this._nwInstallerConfigPatch || {});
|
|
16897
|
+
return { ok: true, revision: this._nwInstallerConfigRevision(),
|
|
16898
|
+
...customerTariffView(root, this.namespace, tariffProviderRegistry.publicRegistry(), this._tariffProviderSnapshot) };
|
|
16899
|
+
};
|
|
16900
|
+
app.get('/api/customer/tariff-provider', requireCustomerWorkspace, requireCustomerTariff, (_req, res) => {
|
|
16901
|
+
try { sendNoStore(res); res.json(customerTariffSnapshot()); }
|
|
16902
|
+
catch (error) { const failure = safeConfigurationFailure(error); res.status(failure.status).json(failure.body); }
|
|
16903
|
+
});
|
|
16904
|
+
app.put('/api/customer/tariff-provider', requireCustomerWorkspace, requireCustomerTariff, async (req, res) => {
|
|
16905
|
+
const token = beginMeshAppSave();
|
|
16906
|
+
if (!token) return res.status(409).json({ ok: false, error: 'EOS_TARIFF_BUSY', message: 'Eine Einstellung wird gerade gespeichert. Bitte kurz warten.' });
|
|
16907
|
+
try {
|
|
16908
|
+
sendNoStore(res);
|
|
16909
|
+
const body = req.body;
|
|
16910
|
+
if (!body || typeof body !== 'object' || Array.isArray(body)
|
|
16911
|
+
|| Object.keys(body).some(key => !['expectedRevision', 'config'].includes(key))) {
|
|
16912
|
+
throw createPublicHttpError(422, 'EOS_TARIFF_INVALID', 'Die Tarifanfrage enthält unzulässige Felder.');
|
|
16913
|
+
}
|
|
16914
|
+
// Unlike legacy installer clients, this new API always requires a freshly loaded revision.
|
|
16915
|
+
if (typeof body.expectedRevision !== 'string' || body.expectedRevision !== this._nwInstallerConfigRevision()) {
|
|
16916
|
+
throw createPublicHttpError(409, 'EOS_TARIFF_CONFIG_CHANGED', 'Die Anlageneinstellungen wurden inzwischen geändert. Bitte den Tarif neu laden und deine Eingaben vergleichen.');
|
|
16917
|
+
}
|
|
16918
|
+
if (this._nwShuttingDown || this._bridge.canWrite() !== true) throw createPublicHttpError(409, 'EOS_UI_OWNERSHIP_REQUIRED', 'Die Systemfreigabe ist nicht verfügbar.');
|
|
16919
|
+
const effective = this.nwApplyInstallerPatchToRuntimeConfig(this.config || {}, this._nwInstallerConfigPatch || {});
|
|
16920
|
+
const changed = prepareCustomerTariffChange(effective, body.config, this.namespace, tariffProviderRegistry.publicRegistry());
|
|
16921
|
+
const patch = this._nwDeepClone(this._nwInstallerConfigPatch || {});
|
|
16922
|
+
patch.tariffProvider = changed.tariffProvider;
|
|
16923
|
+
if (changed.datapoints) patch.datapoints = changed.datapoints;
|
|
16924
|
+
if (await this.persistInstallerConfigToState(patch) === false) throw createPublicHttpError(503, 'EOS_TARIFF_SAVE_FAILED', 'Der Tarif konnte nicht gespeichert werden. Bisherige Einstellungen bleiben bestehen.');
|
|
16925
|
+
this._nwInstallerConfigPatch = patch;
|
|
16926
|
+
this._nwInstallerConfigRawPatch = this._nwDeepClone(patch);
|
|
16927
|
+
this.config = this.nwApplyInstallerPatchToRuntimeConfig(this.config || {}, patch);
|
|
16928
|
+
try {
|
|
16929
|
+
const tariffModule = this.emsEngine?.mm?.modules?.find(entry => entry.key === 'tariffProvider')?.instance;
|
|
16930
|
+
if (tariffModule && typeof tariffModule.invalidateConfiguration === 'function') await tariffModule.invalidateConfiguration();
|
|
16931
|
+
if (changed.datapoints && tariffModule && typeof tariffModule.applyTariffMappings === 'function') await tariffModule.applyTariffMappings();
|
|
16932
|
+
// No EMS restart and no actuator activation. Changed read mappings use existing subscriptions.
|
|
16933
|
+
if (changed.datapoints) await this.subscribeConfiguredStates();
|
|
16934
|
+
} catch (_error) {
|
|
16935
|
+
throw createPublicHttpError(503, 'EOS_TARIFF_APPLY_PENDING', 'Der Tarif ist gespeichert. Die Übernahme der neuen Preisquelle ist noch nicht bestätigt; bitte Status neu laden.');
|
|
16936
|
+
}
|
|
16937
|
+
try { await this.nwWriteUserdataBackup(patch, 'customer-tariff'); }
|
|
16938
|
+
catch (_error) { this.log.warn('EOS_TARIFF_BACKUP_FAILED: Tarif gespeichert; zusätzliche Sicherung fehlgeschlagen.'); }
|
|
16939
|
+
res.json(customerTariffSnapshot());
|
|
16940
|
+
} catch (error) {
|
|
16941
|
+
const failure = safeConfigurationFailure(error);
|
|
16942
|
+
res.status(failure.status).json(failure.body);
|
|
16943
|
+
} finally { endMeshAppSave(token); }
|
|
16944
|
+
});
|
|
16945
|
+
|
|
16870
16946
|
// Dynamische Tarife: Provider-Katalog und Verbindungstest. Die APIs sind
|
|
16871
16947
|
// installergeschützt und geben niemals Token/Secrets zurück.
|
|
16872
16948
|
app.get('/api/installer/tariff-provider/providers', requireInstaller, async (_req, res) => {
|
|
@@ -16925,16 +17001,20 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
16925
17001
|
app.get('/api/nwdevices/discover', requireInstaller, async (_req, res) => {
|
|
16926
17002
|
try {
|
|
16927
17003
|
const now = Date.now();
|
|
16928
|
-
const
|
|
16929
|
-
const stateObjects =
|
|
16930
|
-
|
|
16931
|
-
|
|
16932
|
-
|
|
17004
|
+
const patterns = ['nexowatt-devices.*.devices.*', `${this._owner.namespace}.devices.*`];
|
|
17005
|
+
const devChannels = {}; const stateObjects = {}; const manifestStates = {};
|
|
17006
|
+
for (const pattern of patterns) {
|
|
17007
|
+
Object.assign(devChannels, await this.getForeignObjectsAsync(pattern, 'channel'));
|
|
17008
|
+
Object.assign(stateObjects, await this.getForeignObjectsAsync(pattern, 'state'));
|
|
17009
|
+
if (typeof this.getForeignStatesAsync === 'function') {
|
|
17010
|
+
Object.assign(manifestStates, await this.getForeignStatesAsync(`${pattern}.aliases.meta.manifest`));
|
|
17011
|
+
}
|
|
17012
|
+
}
|
|
16933
17013
|
|
|
16934
17014
|
const statesByDev = new Map();
|
|
16935
17015
|
for (const [stateId, obj] of Object.entries(stateObjects || {})) {
|
|
16936
17016
|
const sid = String(stateId || '');
|
|
16937
|
-
const match = sid.match(/^(nexowatt-devices\.\d+\.devices\.
|
|
17017
|
+
const match = sid.match(/^((?:nexowatt-devices|eos-admin)\.\d+\.devices\..+)\.aliases\./);
|
|
16938
17018
|
if (!match) continue;
|
|
16939
17019
|
if (!statesByDev.has(match[1])) statesByDev.set(match[1], {});
|
|
16940
17020
|
statesByDev.get(match[1])[sid] = obj;
|
|
@@ -16977,13 +17057,15 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
16977
17057
|
|
|
16978
17058
|
for (const [baseRaw, channelObj] of Object.entries(devChannels || {})) {
|
|
16979
17059
|
const baseId = String(baseRaw || '');
|
|
16980
|
-
const match = baseId.match(/^(nexowatt-devices\.\d+)\.devices\.(
|
|
17060
|
+
const match = baseId.match(/^((?:nexowatt-devices|eos-admin)\.\d+)\.devices\.(.+)$/);
|
|
16981
17061
|
if (!match) continue;
|
|
16982
17062
|
const instance = match[1];
|
|
16983
17063
|
const devId = match[2];
|
|
16984
17064
|
instances.add(instance);
|
|
16985
17065
|
const common = channelObj && channelObj.common && typeof channelObj.common === 'object' ? channelObj.common : {};
|
|
16986
17066
|
const native = channelObj && channelObj.native && typeof channelObj.native === 'object' ? channelObj.native : {};
|
|
17067
|
+
// Alias/group channels are not devices; dotted device IDs retain their full identity.
|
|
17068
|
+
if (!native.category && !Object.hasOwn(manifestStates, `${baseId}.aliases.meta.manifest`)) continue;
|
|
16987
17069
|
const devStates = statesByDev.get(baseId) || {};
|
|
16988
17070
|
const manifest = parseManifest(baseId) || {};
|
|
16989
17071
|
const category = String(native.category || manifest.category || '').trim();
|
|
@@ -33936,6 +34018,10 @@ function createHostedRuntime(owner, bridge) {
|
|
|
33936
34018
|
}
|
|
33937
34019
|
await startPromise;
|
|
33938
34020
|
},
|
|
34021
|
+
reconcileDeviceEms(devices) {
|
|
34022
|
+
if (stopRequested) return Promise.reject(new Error('EOS_UI_STOPPING'));
|
|
34023
|
+
return runtime.reconcileDeviceEms(devices);
|
|
34024
|
+
},
|
|
33939
34025
|
startOperational() { if (!stopRequested) operationalArmed = true; return startOperational(); },
|
|
33940
34026
|
handle(req, res, next) {
|
|
33941
34027
|
if (!started || stopRequested || !runtime._hostedApp) return res.status(503).json({ error: 'EOS_UI_UNAVAILABLE' });
|
package/ui/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nexowatt-eos-ui-internal",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.18",
|
|
4
4
|
"description": "Internal UI and EMS module hosted by iobroker.eos-admin; not an ioBroker adapter entry point.",
|
|
5
5
|
"author": "NexoWatt",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -1094,8 +1094,6 @@
|
|
|
1094
1094
|
"docs/reports/smarthome-import-2026-11-19/runtime-evidence.json",
|
|
1095
1095
|
"docs/reports/smarthome-import-2026-11-19/helper-eslint.json",
|
|
1096
1096
|
"docs/reports/auth-profiles-2026-11-19/ui-contract-evidence.json",
|
|
1097
|
-
"admin/react/assets/nexowatt-192-43ZwQ44y.png",
|
|
1098
|
-
"admin/react/index.html",
|
|
1099
1097
|
"docs/reports/smarthome-auth-2026-11-19/BESTANDSKOMPATIBILITAET_DE.md",
|
|
1100
1098
|
"integrations/eos-admin-dev9/README.txt",
|
|
1101
1099
|
"integrations/eos-admin-dev9/apply-ui-login.cjs",
|
|
@@ -1119,8 +1117,14 @@
|
|
|
1119
1117
|
"tsconfig.ui-pwa.json",
|
|
1120
1118
|
"scripts/verify-ui-pwa.cjs",
|
|
1121
1119
|
"docs/security/UI_PWA_BOOTSTRAP_DE.md",
|
|
1120
|
+
"admin/react/assets/index-Bq5IupDw.js",
|
|
1122
1121
|
"admin/react/assets/index-CuquHlsY.css",
|
|
1123
|
-
"admin/react/assets/
|
|
1122
|
+
"admin/react/assets/nexowatt-192-43ZwQ44y.png",
|
|
1123
|
+
"admin/react/index.html",
|
|
1124
|
+
"lib/installer-lifecycle.js",
|
|
1125
|
+
"lib/customer-tariff.js",
|
|
1126
|
+
"www/customer-tariff.js",
|
|
1127
|
+
"www/customer-tariff.css"
|
|
1124
1128
|
],
|
|
1125
1129
|
"devDependencies": {
|
|
1126
1130
|
"@iobroker/adapter-dev": "^1.5.0",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* Copyright (c) 2026 NexoWatt. Confidential and proprietary. */
|
|
2
|
+
.nw-customer-tariff { margin: 16px 0 24px; padding: 18px; border: 1px solid #235363; border-radius: 14px; background: #09212c; }
|
|
3
|
+
.nw-customer-tariff > summary { cursor: pointer; font-weight: 700; color: #dff8ef; }
|
|
4
|
+
.nw-customer-tariff > summary span { display: block; font-size: .8rem; color: #a4bdca; margin: 6px 0 0 18px; font-weight: 400; }
|
|
5
|
+
.nw-customer-tariff p, .nw-customer-tariff small { color: #acc5d2; line-height: 1.55; }
|
|
6
|
+
.nw-customer-tariff fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
|
|
7
|
+
.nw-customer-tariff legend { font-size: 1rem; font-weight: 700; padding: 10px 0; }
|
|
8
|
+
.nw-customer-tariff-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 14px; }
|
|
9
|
+
.nw-customer-tariff label { display: flex; flex-direction: column; min-width: 0; gap: 8px; font-size: .85rem; color: #d5e5ed; }
|
|
10
|
+
.nw-customer-tariff input:not([type="checkbox"]), .nw-customer-tariff select { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; padding: 10px 12px; border: 1px solid #426879; border-radius: 8px; background: #05131d; color: #e4f5f1; min-height: 44px; font: inherit; }
|
|
11
|
+
.nw-customer-tariff .nw-customer-tariff-check { flex-direction: row; align-items: center; gap: 10px; }
|
|
12
|
+
.nw-customer-tariff input[type="checkbox"] { flex: 0 0 auto; width: 18px; height: 18px; accent-color: #00d69a; }
|
|
13
|
+
.nw-customer-tariff :is(input, select, button, summary):focus-visible { outline: 2px solid #47e7bc; outline-offset: 3px; }
|
|
14
|
+
.nw-customer-tariff [hidden] { display: none !important; }
|
|
15
|
+
.nw-customer-tariff details { margin: 16px 0; padding: 14px; border: 1px solid #254755; border-radius: 10px; }
|
|
16
|
+
.nw-customer-tariff details summary { cursor: pointer; font-weight: 650; }
|
|
17
|
+
.nw-customer-tariff-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
|
|
18
|
+
.nw-customer-tariff-actions button { white-space: normal; min-height: 44px; }
|
|
19
|
+
#customerTariffStatus[data-error="true"] { color: #ffb2a7; }
|
|
20
|
+
#customerTariffStatus[data-error="false"] { color: #86e5c1; }
|
|
21
|
+
.nw-customer-tariff-hint { border-left: 2px solid #31b99b; padding-left: 12px; }
|