iobroker.nexowatt-ui 0.7.46 → 0.7.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ems/modules/core-limits.js +36 -37
- package/ems/modules/heating-rod-control.js +41 -47
- package/io-package.json +6 -2
- package/main.js +10 -31
- package/package.json +1 -1
- package/www/app.js +8 -35
- package/www/ems-apps.js +42 -11
- package/www/manifest.webmanifest +1 -1
- package/www/sw.js +1 -1
|
@@ -565,45 +565,44 @@ class CoreLimitsModule extends BaseModule {
|
|
|
565
565
|
return Math.max(0, this._readCacheNumber(['derived.core.pv.totalW', 'pvPower', 'productionTotal', 'storageFarm.totalPvPowerW'], 0) || 0);
|
|
566
566
|
})();
|
|
567
567
|
|
|
568
|
-
//
|
|
569
|
-
//
|
|
570
|
-
//
|
|
571
|
-
//
|
|
572
|
-
let storageChargeW =
|
|
573
|
-
let storageDischargeW =
|
|
574
|
-
|
|
575
|
-
if (isFiniteNumber(batteryPowerW)) {
|
|
576
|
-
const flowBatteryMapped = !!(cfg.datapoints && String(cfg.datapoints.batteryPower || '').trim());
|
|
577
|
-
const farmActive = !!this._readCacheNumber(['storageFarm.enabled'], 0);
|
|
578
|
-
// Apply the VIS inversion only to a raw mapped batteryPower datapoint.
|
|
579
|
-
// If batteryPower was mirrored from the already-normalized storage pair/farm,
|
|
580
|
-
// flipping it here again would swap charge/discharge twice.
|
|
581
|
-
const invBattery = flowBatteryMapped && !farmActive && !!(cfg.settings && cfg.settings.flowInvertBattery);
|
|
582
|
-
const signed = Math.round(invBattery ? -batteryPowerW : batteryPowerW);
|
|
583
|
-
if (signed < -25) {
|
|
584
|
-
storageChargeW = Math.max(storageChargeW, Math.abs(signed));
|
|
585
|
-
storageDischargeW = 0;
|
|
586
|
-
} else if (signed > 25) {
|
|
587
|
-
storageDischargeW = Math.max(storageDischargeW, signed);
|
|
588
|
-
storageChargeW = 0;
|
|
589
|
-
} else {
|
|
590
|
-
storageChargeW = 0;
|
|
591
|
-
storageDischargeW = 0;
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
// Guard against ghost split-battery aliases: with no direct house-load meter,
|
|
596
|
-
// discharge + NVP export would inflate house load and reduce the PV budget.
|
|
597
|
-
// This keeps signed batteryPower and direct load meters authoritative, but avoids
|
|
598
|
-
// bad powerDischarge aliases breaking Heizstab/EMS budgets.
|
|
568
|
+
// Speicherleistung wird zentral wie im Energiefluss aufgelöst:
|
|
569
|
+
// - getrennte Lade-/Entlade-DPs bleiben vollständig gültig
|
|
570
|
+
// - signed Batterie-DP bleibt gültig (- = Laden, + = Entladen; invertierbar)
|
|
571
|
+
// - nur wenn keine frische Messquelle vorhanden ist, wird rechnerisch über die Bilanz abgeleitet
|
|
572
|
+
let storageChargeW = 0;
|
|
573
|
+
let storageDischargeW = 0;
|
|
574
|
+
let usedCentralStorageFlow = false;
|
|
599
575
|
try {
|
|
600
|
-
const
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
if (
|
|
604
|
-
|
|
576
|
+
const flow = (this.adapter && typeof this.adapter._nwResolveBatteryFlowFromCache === 'function')
|
|
577
|
+
? this.adapter._nwResolveBatteryFlowFromCache({ maxAgeMs: staleMs, deadbandW: 25 })
|
|
578
|
+
: null;
|
|
579
|
+
if (flow && typeof flow === 'object') {
|
|
580
|
+
usedCentralStorageFlow = true;
|
|
581
|
+
storageChargeW = Math.max(0, Math.round(Number(flow.chargeW) || 0));
|
|
582
|
+
storageDischargeW = Math.max(0, Math.round(Number(flow.dischargeW) || 0));
|
|
605
583
|
}
|
|
606
|
-
} catch (
|
|
584
|
+
} catch (_eFlow) {}
|
|
585
|
+
|
|
586
|
+
if (!usedCentralStorageFlow) {
|
|
587
|
+
// Fallback für sehr alte Laufzeiten ohne zentralen Resolver. Keine Plausibilitäts-
|
|
588
|
+
// Unterdrückung hier: gemappte Split-DPs sind autoritativ.
|
|
589
|
+
storageChargeW = Math.max(0, this._readCacheNumberMax(['storageFarm.totalChargePowerW', 'storageChargePower'], 0) || 0);
|
|
590
|
+
storageDischargeW = Math.max(0, this._readCacheNumberMax(['storageFarm.totalDischargePowerW', 'storageDischargePower'], 0) || 0);
|
|
591
|
+
const batteryPowerW = this._readCacheNumber(['batteryPower'], null);
|
|
592
|
+
if (isFiniteNumber(batteryPowerW)) {
|
|
593
|
+
const flowBatteryMapped = !!(cfg.datapoints && String(cfg.datapoints.batteryPower || '').trim());
|
|
594
|
+
const farmActive = !!this._readCacheNumber(['storageFarm.enabled'], 0);
|
|
595
|
+
const invBattery = flowBatteryMapped && !farmActive && !!(cfg.settings && cfg.settings.flowInvertBattery);
|
|
596
|
+
const signed = Math.round(invBattery ? -batteryPowerW : batteryPowerW);
|
|
597
|
+
if (signed < -25) {
|
|
598
|
+
storageChargeW = Math.max(storageChargeW, Math.abs(signed));
|
|
599
|
+
storageDischargeW = 0;
|
|
600
|
+
} else if (signed > 25) {
|
|
601
|
+
storageDischargeW = Math.max(storageDischargeW, signed);
|
|
602
|
+
storageChargeW = 0;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
607
606
|
|
|
608
607
|
const evcsEnabled = cfg.enableChargingManagement !== false;
|
|
609
608
|
const thermalEnabled = cfg.enableThermalControl === true;
|
|
@@ -604,42 +604,47 @@ class HeatingRodControlModule extends BaseModule {
|
|
|
604
604
|
}
|
|
605
605
|
|
|
606
606
|
_readStorageSnapshot(staleMs) {
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
if (
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
if (
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
607
|
+
let chargeW = 0;
|
|
608
|
+
let dischargeW = 0;
|
|
609
|
+
let usedCentralStorageFlow = false;
|
|
610
|
+
try {
|
|
611
|
+
const flow = (this.adapter && typeof this.adapter._nwResolveBatteryFlowFromCache === 'function')
|
|
612
|
+
? this.adapter._nwResolveBatteryFlowFromCache({ maxAgeMs: staleMs, deadbandW: 25 })
|
|
613
|
+
: null;
|
|
614
|
+
if (flow && typeof flow === 'object') {
|
|
615
|
+
usedCentralStorageFlow = true;
|
|
616
|
+
chargeW = Math.max(0, Math.round(Number(flow.chargeW) || 0));
|
|
617
|
+
dischargeW = Math.max(0, Math.round(Number(flow.dischargeW) || 0));
|
|
618
|
+
}
|
|
619
|
+
} catch (_eFlow) {}
|
|
620
|
+
|
|
621
|
+
if (!usedCentralStorageFlow) {
|
|
622
|
+
// Fallback für ältere Laufzeiten: Split-DPs und signed DP bleiben wie bisher erlaubt.
|
|
623
|
+
chargeW = Math.max(0, num(this._readNumberMaxAny([
|
|
624
|
+
'storageFarm.totalChargePowerW',
|
|
625
|
+
'storageChargePower'
|
|
626
|
+
], staleMs, null), 0));
|
|
627
|
+
|
|
628
|
+
dischargeW = Math.max(0, num(this._readNumberMaxAny([
|
|
629
|
+
'storageFarm.totalDischargePowerW',
|
|
630
|
+
'storageDischargePower'
|
|
631
|
+
], staleMs, null), 0));
|
|
632
|
+
|
|
633
|
+
const batteryPowerW = this._readNumberAny(['batteryPower'], staleMs, null);
|
|
634
|
+
if (typeof batteryPowerW === 'number' && Number.isFinite(batteryPowerW)) {
|
|
635
|
+
const cfg = (this.adapter && this.adapter.config) ? this.adapter.config : {};
|
|
636
|
+
const flowBatteryMapped = !!(cfg.datapoints && String(cfg.datapoints.batteryPower || '').trim());
|
|
637
|
+
const farmActive = !!this._readCacheNumber('storageFarm.enabled', 0);
|
|
638
|
+
const invBattery = flowBatteryMapped && !farmActive && !!(cfg.settings && cfg.settings.flowInvertBattery);
|
|
639
|
+
const signedW = Math.round(invBattery ? -batteryPowerW : batteryPowerW);
|
|
640
|
+
const noiseW = 25;
|
|
641
|
+
if (signedW < -noiseW) {
|
|
642
|
+
chargeW = Math.max(chargeW, Math.abs(signedW));
|
|
643
|
+
dischargeW = 0;
|
|
644
|
+
} else if (signedW > noiseW) {
|
|
645
|
+
dischargeW = Math.max(dischargeW, signedW);
|
|
646
|
+
chargeW = 0;
|
|
647
|
+
}
|
|
643
648
|
}
|
|
644
649
|
}
|
|
645
650
|
|
|
@@ -691,17 +696,6 @@ class HeatingRodControlModule extends BaseModule {
|
|
|
691
696
|
const exportW = gridKnown ? Math.max(0, -gridW) : 0;
|
|
692
697
|
const importW = gridKnown ? Math.max(0, gridW) : 0;
|
|
693
698
|
const storage = this._readStorageSnapshot(staleMs);
|
|
694
|
-
try {
|
|
695
|
-
const appCfg = (this.adapter && this.adapter.config) ? this.adapter.config : {};
|
|
696
|
-
const hasDirectLoad = !!(appCfg.datapoints && (String(appCfg.datapoints.consumptionTotal || '').trim() || String(appCfg.datapoints.housePower || '').trim()));
|
|
697
|
-
const splitBatteryConfigured = !!(appCfg.datapoints && (String(appCfg.datapoints.storageChargePower || '').trim() || String(appCfg.datapoints.storageDischargePower || '').trim()));
|
|
698
|
-
const signedBatteryConfigured = !!(appCfg.datapoints && String(appCfg.datapoints.batteryPower || '').trim());
|
|
699
|
-
if (!hasDirectLoad && splitBatteryConfigured && !signedBatteryConfigured && exportW > 250 && storage.dischargeW > 250 && storage.chargeW <= 250) {
|
|
700
|
-
storage.dischargeW = 0;
|
|
701
|
-
storage.sanitizedExportDischarge = true;
|
|
702
|
-
}
|
|
703
|
-
} catch (_eSanitizeStorage) {}
|
|
704
|
-
|
|
705
699
|
const storageTargetSocPct = clamp(num(cfg.storageTargetSocPct, 90), 0, 100);
|
|
706
700
|
const storageReserveCfgW = Math.max(0, Math.round(num(cfg.storageReserveW, 1000)));
|
|
707
701
|
const storageKnown = storage.chargeW > 0
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "nexowatt-ui",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.47",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.7.47": {
|
|
7
|
+
"en": "Energy-flow datapoint resolver fixed: split charge/discharge datapoints and signed battery power are supported consistently again; calculated fallback is only used when a fresh measurement source is missing. Heating-rod reserve inputs are flushed before save.",
|
|
8
|
+
"de": "Energiefluss-Datenpunktauflösung korrigiert: getrennte Lade-/Entlade-Datenpunkte und signed Batterie-Leistung werden wieder konsistent unterstützt; der rechnerische Fallback greift nur, wenn keine frische Messquelle vorhanden ist. Heizstab-Reservefelder werden vor dem Speichern direkt übernommen."
|
|
9
|
+
},
|
|
6
10
|
"0.7.42": {
|
|
7
11
|
"en": "Feature-dependent visibility fixed: EVCS/charging station and storage farm are only shown in the customer frontend when they are actually configured. Default/legacy placeholders no longer enable wallbox UI; AI Advisor suppresses EV/wallbox hints when no wallbox is available.",
|
|
8
12
|
"de": "Anlagenabhängige Sichtbarkeit korrigiert: EVCS/Ladestation und Speicherfarm erscheinen im Kunden-Frontend nur noch, wenn sie wirklich konfiguriert sind. Default-/Legacy-Placeholder aktivieren keine Wallbox-Anzeige mehr; KI-Empfehlungen verzichten ohne Wallbox auf EV-/Wallbox-Hinweise."
|
|
@@ -1987,7 +1991,7 @@
|
|
|
1987
1991
|
}
|
|
1988
1992
|
},
|
|
1989
1993
|
"instanceObjects": [],
|
|
1990
|
-
"version": "0.7.
|
|
1994
|
+
"version": "0.7.47",
|
|
1991
1995
|
"news": {
|
|
1992
1996
|
"0.7.42": {
|
|
1993
1997
|
"en": "Feature-dependent visibility fixed: EVCS/charging station and storage farm are only shown in the customer frontend when they are actually configured. Default/legacy placeholders no longer enable wallbox UI; AI Advisor suppresses EV/wallbox hints when no wallbox is available.",
|
package/main.js
CHANGED
|
@@ -17727,43 +17727,20 @@ Technische Details: system.adapter.${c.inst}.alive=false`,
|
|
|
17727
17727
|
|
|
17728
17728
|
const preferBalance = (current) => {
|
|
17729
17729
|
try {
|
|
17730
|
-
const measured = Math.max(0, Math.abs(Number(current && current.chargeW) || 0) + Math.abs(Number(current && current.dischargeW) || 0));
|
|
17731
17730
|
const srcCur = String(current && current.src || '');
|
|
17732
|
-
const missingLike = !current || srcCur === 'missing' || srcCur === 'stale-or-missing';
|
|
17731
|
+
const missingLike = !current || srcCur === 'missing' || srcCur === 'stale-or-missing' || current.incomplete === true;
|
|
17732
|
+
if (!missingLike) return current;
|
|
17733
17733
|
const derived = fromBalance();
|
|
17734
17734
|
if (!derived) return current;
|
|
17735
|
-
|
|
17736
|
-
|
|
17735
|
+
return Object.assign({}, derived, {
|
|
17736
|
+
src: String(derived.src || 'balanceDerived') + (current && current.incomplete ? '+missing-side' : ''),
|
|
17737
|
+
fallbackFor: srcCur || 'missing'
|
|
17738
|
+
});
|
|
17737
17739
|
} catch (_ePrefer) {
|
|
17738
17740
|
return current;
|
|
17739
17741
|
}
|
|
17740
17742
|
};
|
|
17741
17743
|
|
|
17742
|
-
const sanitizeSeparateBatteryFlow = (flow) => {
|
|
17743
|
-
try {
|
|
17744
|
-
if (!flow || String(flow.src || '').indexOf('chargeDischarge') < 0) return flow;
|
|
17745
|
-
const hasDirectLoad = this._nwHasMappedDatapoint('consumptionTotal') || this._nwHasMappedDatapoint('housePower');
|
|
17746
|
-
if (hasDirectLoad) return flow;
|
|
17747
|
-
const grid = this._nwResolveGridImportExportFromCache ? this._nwResolveGridImportExportFromCache() : null;
|
|
17748
|
-
const sellW = Math.max(0, Number(grid && grid.gridSellW) || 0);
|
|
17749
|
-
const dischargeW = Math.max(0, Number(flow.dischargeW) || 0);
|
|
17750
|
-
const chargeW = Math.max(0, Number(flow.chargeW) || 0);
|
|
17751
|
-
const limitW = Math.max(250, deadbandW * 10);
|
|
17752
|
-
if (sellW > limitW && dischargeW > limitW && chargeW <= limitW) {
|
|
17753
|
-
return Object.assign({}, flow, {
|
|
17754
|
-
chargeW: 0,
|
|
17755
|
-
dischargeW: 0,
|
|
17756
|
-
signedW: 0,
|
|
17757
|
-
src: String(flow.src || 'chargeDischarge') + '+sanitized-export-discharge',
|
|
17758
|
-
rejectedDischargeW: Math.round(dischargeW),
|
|
17759
|
-
sanitized: true,
|
|
17760
|
-
mirror: true
|
|
17761
|
-
});
|
|
17762
|
-
}
|
|
17763
|
-
} catch (_eSanitize) {}
|
|
17764
|
-
return flow;
|
|
17765
|
-
};
|
|
17766
|
-
|
|
17767
17744
|
// Speicherfarm already provides normalized charge/discharge totals. Keep it authoritative
|
|
17768
17745
|
// unless a signed single battery datapoint is explicitly mapped for a non-farm setup.
|
|
17769
17746
|
const sfEnabled = !!(this.stateCache && this.stateCache['storageFarm.enabled'] && this.stateCache['storageFarm.enabled'].value);
|
|
@@ -17821,7 +17798,8 @@ Technische Details: system.adapter.${c.inst}.alive=false`,
|
|
|
17821
17798
|
if (c <= deadbandW) c = 0;
|
|
17822
17799
|
if (d <= deadbandW) d = 0;
|
|
17823
17800
|
if (inv) { const t = c; c = d; d = t; }
|
|
17824
|
-
|
|
17801
|
+
const completePair = !!(chargeMapped && dischargeMapped && chargeRaw !== null && dischargeRaw !== null && !sameChargeDischargeId);
|
|
17802
|
+
return preferBalance({
|
|
17825
17803
|
chargeW: Math.round(c),
|
|
17826
17804
|
dischargeW: Math.round(d),
|
|
17827
17805
|
signedW: Math.round(d - c),
|
|
@@ -17829,11 +17807,12 @@ Technische Details: system.adapter.${c.inst}.alive=false`,
|
|
|
17829
17807
|
inverted: inv,
|
|
17830
17808
|
fromSigned: false,
|
|
17831
17809
|
mirror: sameChargeDischargeId || !chargeMapped || !dischargeMapped,
|
|
17810
|
+
incomplete: !completePair,
|
|
17832
17811
|
staleMs: {
|
|
17833
17812
|
storageChargePower: this._nwGetCacheAgeMs('storageChargePower', now),
|
|
17834
17813
|
storageDischargePower: this._nwGetCacheAgeMs('storageDischargePower', now),
|
|
17835
17814
|
},
|
|
17836
|
-
})
|
|
17815
|
+
});
|
|
17837
17816
|
}
|
|
17838
17817
|
|
|
17839
17818
|
if (batterySigned !== null) {
|
package/package.json
CHANGED
package/www/app.js
CHANGED
|
@@ -2109,13 +2109,15 @@ function getBalanceDerivedBatteryFlow(opts = {}) {
|
|
|
2109
2109
|
function preferBalanceDerivedBatteryFlow(current, opts = {}) {
|
|
2110
2110
|
try {
|
|
2111
2111
|
const deadbandW = Number.isFinite(Number(opts.deadbandW)) ? Math.max(180, Number(opts.deadbandW)) : 180;
|
|
2112
|
-
const measured = Math.max(0, Math.abs(Number(current && current.chargeW) || 0) + Math.abs(Number(current && current.dischargeW) || 0));
|
|
2113
2112
|
const src = String(current && current.src || '');
|
|
2114
|
-
const missingLike = !current || src === 'missing' || src === 'stale-or-missing';
|
|
2113
|
+
const missingLike = !current || src === 'missing' || src === 'stale-or-missing' || current.incomplete === true;
|
|
2114
|
+
if (!missingLike) return current;
|
|
2115
2115
|
const derived = getBalanceDerivedBatteryFlow({ deadbandW });
|
|
2116
2116
|
if (!derived) return current;
|
|
2117
|
-
|
|
2118
|
-
|
|
2117
|
+
return Object.assign({}, derived, {
|
|
2118
|
+
src: String(derived.src || 'balanceDerived') + (current && current.incomplete ? '+missing-side' : ''),
|
|
2119
|
+
fallbackFor: src || 'missing'
|
|
2120
|
+
});
|
|
2119
2121
|
} catch (_e) {
|
|
2120
2122
|
return current;
|
|
2121
2123
|
}
|
|
@@ -2146,36 +2148,6 @@ function getNormalizedBatteryFlow() {
|
|
|
2146
2148
|
};
|
|
2147
2149
|
};
|
|
2148
2150
|
|
|
2149
|
-
const sanitizeSeparateBatteryFlow = (flow) => {
|
|
2150
|
-
try {
|
|
2151
|
-
if (!flow || String(flow.src || '').indexOf('chargeDischarge') < 0) return flow;
|
|
2152
|
-
// In a normal AC-coupled house setup a storage discharge while the NVP is
|
|
2153
|
-
// exporting and no direct house-load meter is configured is almost always a
|
|
2154
|
-
// vendor-/alias-side ghost value (seen with some nexowatt-devices powerDischarge aliases).
|
|
2155
|
-
// Without a direct load meter this value would inflate the building load and
|
|
2156
|
-
// eat the PV budget. Keep true signed batteryPower authoritative, but guard
|
|
2157
|
-
// the separate charge/discharge pair.
|
|
2158
|
-
const hasDirectLoad = isMappedDatapoint('consumptionTotal') || isMappedDatapoint('housePower');
|
|
2159
|
-
if (hasDirectLoad) return flow;
|
|
2160
|
-
const grid = getGridImportExport((k) => state && state[k] ? state[k].value : undefined);
|
|
2161
|
-
const sellW = Math.max(0, Number(grid && grid.sell) || 0);
|
|
2162
|
-
const dischargeW = Math.max(0, Number(flow.dischargeW) || 0);
|
|
2163
|
-
const chargeW = Math.max(0, Number(flow.chargeW) || 0);
|
|
2164
|
-
const limitW = Math.max(250, deadbandW * 10);
|
|
2165
|
-
if (sellW > limitW && dischargeW > limitW && chargeW <= limitW) {
|
|
2166
|
-
return Object.assign({}, flow, {
|
|
2167
|
-
chargeW: 0,
|
|
2168
|
-
dischargeW: 0,
|
|
2169
|
-
signedW: 0,
|
|
2170
|
-
src: String(flow.src || 'chargeDischarge') + '+sanitized-export-discharge',
|
|
2171
|
-
rejectedDischargeW: Math.round(dischargeW),
|
|
2172
|
-
sanitized: true,
|
|
2173
|
-
});
|
|
2174
|
-
}
|
|
2175
|
-
} catch (_e) {}
|
|
2176
|
-
return flow;
|
|
2177
|
-
};
|
|
2178
|
-
|
|
2179
2151
|
const sfEnabled = !!(state && state['storageFarm.enabled'] && state['storageFarm.enabled'].value);
|
|
2180
2152
|
if (sfEnabled) {
|
|
2181
2153
|
const fc = getFreshFlowNumber('storageFarm.totalChargePowerW');
|
|
@@ -2210,7 +2182,8 @@ function getNormalizedBatteryFlow() {
|
|
|
2210
2182
|
if (c <= deadbandW) c = 0;
|
|
2211
2183
|
if (d <= deadbandW) d = 0;
|
|
2212
2184
|
if (inv) { const t = c; c = d; d = t; }
|
|
2213
|
-
|
|
2185
|
+
const completePair = !!(chargeMapped && dischargeMapped && charge !== null && discharge !== null && !samePair);
|
|
2186
|
+
return preferBalanceDerivedBatteryFlow({ chargeW: c, dischargeW: d, signedW: d - c, src: inv ? 'chargeDischarge(inv)' : 'chargeDischarge', inverted: inv, incomplete: !completePair }, { deadbandW });
|
|
2214
2187
|
}
|
|
2215
2188
|
|
|
2216
2189
|
if (signedBattery !== null) return preferBalanceDerivedBatteryFlow(fromSigned(signedBattery, 'batterySigned'), { deadbandW });
|
package/www/ems-apps.js
CHANGED
|
@@ -2701,6 +2701,36 @@ function _collectFlowPowerDpIsWFromUI() {
|
|
|
2701
2701
|
return inp;
|
|
2702
2702
|
}
|
|
2703
2703
|
|
|
2704
|
+
function _mkHeatingRodNumberInput(key, value, onChange, opts = {}) {
|
|
2705
|
+
const inp = _mkCfgInput('number', value, onChange, opts);
|
|
2706
|
+
inp.dataset.heatingRodCfgKey = String(key || '');
|
|
2707
|
+
inp.id = `heatingRod_${String(key || '').replace(/[^a-zA-Z0-9_-]/g, '_')}`;
|
|
2708
|
+
return inp;
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
|
+
function flushHeatingRodConfigFromDom() {
|
|
2712
|
+
try {
|
|
2713
|
+
if (!document || !document.querySelectorAll) return;
|
|
2714
|
+
currentConfig = currentConfig || {};
|
|
2715
|
+
currentConfig.heatingRod = (currentConfig.heatingRod && typeof currentConfig.heatingRod === 'object') ? currentConfig.heatingRod : {};
|
|
2716
|
+
const h = currentConfig.heatingRod;
|
|
2717
|
+
const numericKeys = new Set([
|
|
2718
|
+
'storageReserveW', 'storageTargetSocPct', 'minPvPowerW', 'budgetSafetyReserveW',
|
|
2719
|
+
'stageUpDelaySec', 'minStageRunSec', 'cooldownAfterOffSec', 'maxGridImportW',
|
|
2720
|
+
'gridImportHoldSec', 'storageDischargeToleranceW', 'storageDischargeHoldSec'
|
|
2721
|
+
]);
|
|
2722
|
+
document.querySelectorAll('[data-heating-rod-cfg-key]').forEach((el) => {
|
|
2723
|
+
const key = String(el.dataset.heatingRodCfgKey || '').trim();
|
|
2724
|
+
if (!key || !numericKeys.has(key)) return;
|
|
2725
|
+
const n = Number(el.value);
|
|
2726
|
+
if (!Number.isFinite(n)) return;
|
|
2727
|
+
if (key === 'storageTargetSocPct') h[key] = Math.max(0, Math.min(100, Math.round(n)));
|
|
2728
|
+
else h[key] = Math.max(0, Math.round(n));
|
|
2729
|
+
});
|
|
2730
|
+
} catch (_e) {}
|
|
2731
|
+
}
|
|
2732
|
+
|
|
2733
|
+
|
|
2704
2734
|
function _mkCfgSelect(value, options, onChange, opts = {}) {
|
|
2705
2735
|
const sel = document.createElement('select');
|
|
2706
2736
|
sel.className = opts.className || 'nw-config-select';
|
|
@@ -3038,10 +3068,10 @@ function _collectFlowPowerDpIsWFromUI() {
|
|
|
3038
3068
|
autoInfo.style.flexBasis = '100%';
|
|
3039
3069
|
autoInfo.textContent = 'Zentrale EMS-Budget-Gates lesen, PV/NVP-Überschuss verfolgen und eigene PV-Auto-Stufen halten. Externe KNX-/Relais-Schaltungen werden nur beobachtet.';
|
|
3040
3070
|
grpAuto.body.appendChild(autoInfo);
|
|
3041
|
-
grpAuto.body.appendChild(_mkCfgField('Speicher-Reserve (W)',
|
|
3042
|
-
grpAuto.body.appendChild(_mkCfgField('Reserve bis SoC (%)',
|
|
3043
|
-
grpAuto.body.appendChild(_mkCfgField('PV-Auto ab PV (W)',
|
|
3044
|
-
grpAuto.body.appendChild(_mkCfgField('Sicherheitsreserve (W)',
|
|
3071
|
+
grpAuto.body.appendChild(_mkCfgField('Speicher-Reserve (W)', _mkHeatingRodNumberInput('storageReserveW', cfg.storageReserveW, (v) => { cfg.storageReserveW = Math.max(0, Math.round(Number(v) || 0)); setDirty(); }, { min: 0, step: 50, width: '150px' }), 'Bleibt für Speicherladung frei, solange der Speicher unter dem Ziel-SoC liegt.'));
|
|
3072
|
+
grpAuto.body.appendChild(_mkCfgField('Reserve bis SoC (%)', _mkHeatingRodNumberInput('storageTargetSocPct', cfg.storageTargetSocPct, (v) => { cfg.storageTargetSocPct = Math.max(0, Math.min(100, Math.round(Number(v) || 0))); setDirty(); }, { min: 0, max: 100, step: 1, width: '130px' }), 'Ab diesem SoC darf der Heizstab den Überschuss ohne Speicherreserve nutzen.'));
|
|
3073
|
+
grpAuto.body.appendChild(_mkCfgField('PV-Auto ab PV (W)', _mkHeatingRodNumberInput('minPvPowerW', cfg.minPvPowerW, (v) => { cfg.minPvPowerW = Math.max(0, Math.round(Number(v) || 0)); setDirty(); }, { min: 0, step: 50, width: '150px' }), 'Start-/Hochschaltgrenze. Unterhalb wird nicht neu zugeschaltet, laufende Auto-Stufen werden aber über Netz-/Speichergates stabil gehalten.'));
|
|
3074
|
+
grpAuto.body.appendChild(_mkCfgField('Sicherheitsreserve (W)', _mkHeatingRodNumberInput('budgetSafetyReserveW', cfg.budgetSafetyReserveW, (v) => { cfg.budgetSafetyReserveW = Math.max(0, Math.round(Number(v) || 0)); setDirty(); }, { min: 0, step: 10, width: '150px' }), 'Abzug vom Heizstab-Budget gegen Messrauschen.'));
|
|
3045
3075
|
els.heatingRodDevices.appendChild(grpAuto.wrap);
|
|
3046
3076
|
|
|
3047
3077
|
const grpSwitch = _mkCfgGroup('Robustes Schalten');
|
|
@@ -3050,13 +3080,13 @@ function _collectFlowPowerDpIsWFromUI() {
|
|
|
3050
3080
|
switchInfo.style.flexBasis = '100%';
|
|
3051
3081
|
switchInfo.textContent = 'Hysterese gegen Netz- und WR-Schwankungen: erst stabil hochfahren, bei kleinem Netzbezug halten und nur nach Haltezeit reduzieren.';
|
|
3052
3082
|
grpSwitch.body.appendChild(switchInfo);
|
|
3053
|
-
grpSwitch.body.appendChild(_mkCfgField('Stufe-hoch Wartezeit (s)',
|
|
3054
|
-
grpSwitch.body.appendChild(_mkCfgField('Min. Laufzeit Auto-Stufe (s)',
|
|
3055
|
-
grpSwitch.body.appendChild(_mkCfgField('Cooldown nach Abwurf (s)',
|
|
3056
|
-
grpSwitch.body.appendChild(_mkCfgField('Netzbezug erlaubt (W)',
|
|
3057
|
-
grpSwitch.body.appendChild(_mkCfgField('Netzbezug Haltezeit (s)',
|
|
3058
|
-
grpSwitch.body.appendChild(_mkCfgField('Speicherentladung erlaubt (W)',
|
|
3059
|
-
grpSwitch.body.appendChild(_mkCfgField('Speicherentladung Haltezeit (s)',
|
|
3083
|
+
grpSwitch.body.appendChild(_mkCfgField('Stufe-hoch Wartezeit (s)', _mkHeatingRodNumberInput('stageUpDelaySec', cfg.stageUpDelaySec, (v) => { cfg.stageUpDelaySec = Math.max(0, Math.round(Number(v) || 0)); setDirty(); }, { min: 0, step: 1, width: '150px' }), 'Maximal eine physische Stufe pro Wartezeit.'));
|
|
3084
|
+
grpSwitch.body.appendChild(_mkCfgField('Min. Laufzeit Auto-Stufe (s)', _mkHeatingRodNumberInput('minStageRunSec', cfg.minStageRunSec, (v) => { cfg.minStageRunSec = Math.max(0, Math.round(Number(v) || 0)); setDirty(); }, { min: 0, step: 1, width: '170px' }), 'Verhindert nervöses Runterschalten bei kurzen Budget-Dellen.'));
|
|
3085
|
+
grpSwitch.body.appendChild(_mkCfgField('Cooldown nach Abwurf (s)', _mkHeatingRodNumberInput('cooldownAfterOffSec', cfg.cooldownAfterOffSec, (v) => { cfg.cooldownAfterOffSec = Math.max(0, Math.round(Number(v) || 0)); setDirty(); }, { min: 0, step: 1, width: '170px' }), 'Wartezeit bevor nach komplettem AUS wieder gestartet wird.'));
|
|
3086
|
+
grpSwitch.body.appendChild(_mkCfgField('Netzbezug erlaubt (W)', _mkHeatingRodNumberInput('maxGridImportW', cfg.maxGridImportW, (v) => { cfg.maxGridImportW = Math.max(0, Math.round(Number(v) || 0)); setDirty(); }, { min: 0, step: 10, width: '150px' }), 'Kleiner erlaubter Bezug, damit der Heizstab bei NVP-Schwankungen an bleibt.'));
|
|
3087
|
+
grpSwitch.body.appendChild(_mkCfgField('Netzbezug Haltezeit (s)', _mkHeatingRodNumberInput('gridImportHoldSec', cfg.gridImportHoldSec, (v) => { cfg.gridImportHoldSec = Math.max(0, Math.round(Number(v) || 0)); setDirty(); }, { min: 0, step: 1, width: '160px' }), 'Erst wenn der Bezug so lange überschritten ist, wird eine Auto-Stufe reduziert.'));
|
|
3088
|
+
grpSwitch.body.appendChild(_mkCfgField('Speicherentladung erlaubt (W)', _mkHeatingRodNumberInput('storageDischargeToleranceW', cfg.storageDischargeToleranceW, (v) => { cfg.storageDischargeToleranceW = Math.max(0, Math.round(Number(v) || 0)); setDirty(); }, { min: 0, step: 10, width: '170px' }), 'Akku-Schutz: kurze Messdellen sind erlaubt, dauerhafte Entladung reduziert Auto-Stufen.'));
|
|
3089
|
+
grpSwitch.body.appendChild(_mkCfgField('Speicherentladung Haltezeit (s)', _mkHeatingRodNumberInput('storageDischargeHoldSec', cfg.storageDischargeHoldSec, (v) => { cfg.storageDischargeHoldSec = Math.max(0, Math.round(Number(v) || 0)); setDirty(); }, { min: 0, step: 1, width: '190px' }), 'Dauer bis zur Reduzierung bei Akku-Entladung.'));
|
|
3060
3090
|
els.heatingRodDevices.appendChild(grpSwitch.wrap);
|
|
3061
3091
|
|
|
3062
3092
|
const grpProtect = _mkCfgDetailsGroup('Erweitert: harte Schutzgrenzen', false);
|
|
@@ -8135,6 +8165,7 @@ function _collectFlowPowerDpIsWFromUI() {
|
|
|
8135
8165
|
}
|
|
8136
8166
|
|
|
8137
8167
|
// Thermik / Heizstab (PV‑Auto für Verbraucher‑Slots)
|
|
8168
|
+
try { flushHeatingRodConfigFromDom(); } catch (_e) {}
|
|
8138
8169
|
patch.thermal = deepMerge({}, currentConfig.thermal || {});
|
|
8139
8170
|
patch.heatingRod = deepMerge({}, currentConfig.heatingRod || {});
|
|
8140
8171
|
patch.bhkw = deepMerge({}, currentConfig.bhkw || {});
|
package/www/manifest.webmanifest
CHANGED
package/www/sw.js
CHANGED