iobroker.nexowatt-ui 0.7.41 → 0.7.42
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/io-package.json +4 -4
- package/main.js +85 -8
- package/package.json +1 -1
- package/www/app.js +97 -13
- package/www/cockpit-shell.js +1 -1
- package/www/evcs-report.js +1 -1
- package/www/evcs.js +2 -2
- package/www/history.js +1 -1
- package/www/logic.js +1 -1
- package/www/manifest.webmanifest +1 -1
- package/www/report-common.js +1 -1
- package/www/smarthome.js +1 -1
- package/www/storagefarm.js +1 -1
- package/www/sw.js +1 -1
- package/www/year-report.js +1 -1
package/io-package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "nexowatt-ui",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.42",
|
|
5
5
|
"news": {
|
|
6
|
-
"0.7.
|
|
6
|
+
"0.7.42": {
|
|
7
7
|
"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
8
|
"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."
|
|
9
9
|
},
|
|
@@ -1979,9 +1979,9 @@
|
|
|
1979
1979
|
}
|
|
1980
1980
|
},
|
|
1981
1981
|
"instanceObjects": [],
|
|
1982
|
-
"version": "0.7.
|
|
1982
|
+
"version": "0.7.42",
|
|
1983
1983
|
"news": {
|
|
1984
|
-
"0.7.
|
|
1984
|
+
"0.7.42": {
|
|
1985
1985
|
"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.",
|
|
1986
1986
|
"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
1987
|
},
|
package/main.js
CHANGED
|
@@ -17662,6 +17662,83 @@ Technische Details: system.adapter.${c.inst}.alive=false`,
|
|
|
17662
17662
|
};
|
|
17663
17663
|
};
|
|
17664
17664
|
|
|
17665
|
+
const fromBalance = () => {
|
|
17666
|
+
try {
|
|
17667
|
+
const balanceDeadbandW = Math.max(180, deadbandW);
|
|
17668
|
+
if (this.stateCache && this.stateCache['storageFarm.enabled'] && this.stateCache['storageFarm.enabled'].value) return null;
|
|
17669
|
+
|
|
17670
|
+
const soc = this._nwGetNumberFromCache('storageSoc');
|
|
17671
|
+
if (!Number.isFinite(Number(soc))) return null;
|
|
17672
|
+
|
|
17673
|
+
// Nur mit direkt gemessenem Hausverbrauch ableiten. Ohne Direktmessung wäre
|
|
17674
|
+
// consumptionTotal evtl. schon aus derselben Bilanz berechnet und damit zirkulär.
|
|
17675
|
+
const hasDirectLoad = this._nwHasMappedDatapoint('consumptionTotal') || this._nwHasMappedDatapoint('housePower');
|
|
17676
|
+
if (!hasDirectLoad) return null;
|
|
17677
|
+
|
|
17678
|
+
let load = this._nwGetNumberFromCache('consumptionTotal');
|
|
17679
|
+
if (load === null || !Number.isFinite(Number(load))) load = this._nwGetNumberFromCache('housePower');
|
|
17680
|
+
if (load === null || !Number.isFinite(Number(load))) return null;
|
|
17681
|
+
|
|
17682
|
+
const grid = this._nwResolveGridImportExportFromCache ? this._nwResolveGridImportExportFromCache() : null;
|
|
17683
|
+
if (!grid || !grid.hasGrid) return null;
|
|
17684
|
+
|
|
17685
|
+
let pv = this._nwGetNumberFromCache('pvPower');
|
|
17686
|
+
if ((pv === null || !Number.isFinite(Number(pv))) && this._nwHasMappedDatapoint('productionTotal')) {
|
|
17687
|
+
pv = this._nwGetNumberFromCache('productionTotal');
|
|
17688
|
+
}
|
|
17689
|
+
if (pv === null || !Number.isFinite(Number(pv))) return null;
|
|
17690
|
+
|
|
17691
|
+
let production = Math.max(0, Math.abs(Number(pv) || 0));
|
|
17692
|
+
for (let i = 1; i <= 5; i++) {
|
|
17693
|
+
const extra = this._nwGetNumberFromCache(`producer${i}Power`);
|
|
17694
|
+
if (Number.isFinite(Number(extra))) production += Math.max(0, Math.abs(Number(extra)));
|
|
17695
|
+
}
|
|
17696
|
+
|
|
17697
|
+
const buy = Math.max(0, Number(grid.gridBuyW) || 0);
|
|
17698
|
+
const sell = Math.max(0, Number(grid.gridSellW) || 0);
|
|
17699
|
+
const signed = Math.round(Math.max(0, Number(load) || 0) - production - buy + sell);
|
|
17700
|
+
if (!Number.isFinite(signed) || Math.abs(signed) <= balanceDeadbandW) return null;
|
|
17701
|
+
|
|
17702
|
+
const activity = production + Math.max(0, Number(load) || 0) + buy + sell;
|
|
17703
|
+
if (activity < 500) return null;
|
|
17704
|
+
if (Math.abs(signed) > Math.max(3000, activity * 1.15)) return null;
|
|
17705
|
+
if (signed < 0 && Number(soc) >= 99.5) return null;
|
|
17706
|
+
if (signed > 0 && Number(soc) <= 0.5) return null;
|
|
17707
|
+
|
|
17708
|
+
return {
|
|
17709
|
+
chargeW: signed < 0 ? Math.abs(signed) : 0,
|
|
17710
|
+
dischargeW: signed > 0 ? signed : 0,
|
|
17711
|
+
signedW: signed,
|
|
17712
|
+
src: 'balanceDerived',
|
|
17713
|
+
inverted: false,
|
|
17714
|
+
fromSigned: false,
|
|
17715
|
+
mirror: true,
|
|
17716
|
+
staleMs: {
|
|
17717
|
+
balance: 0,
|
|
17718
|
+
batteryPower: this._nwGetCacheAgeMs('batteryPower', now),
|
|
17719
|
+
storageChargePower: this._nwGetCacheAgeMs('storageChargePower', now),
|
|
17720
|
+
storageDischargePower: this._nwGetCacheAgeMs('storageDischargePower', now),
|
|
17721
|
+
},
|
|
17722
|
+
};
|
|
17723
|
+
} catch (_eBalance) {
|
|
17724
|
+
return null;
|
|
17725
|
+
}
|
|
17726
|
+
};
|
|
17727
|
+
|
|
17728
|
+
const preferBalance = (current) => {
|
|
17729
|
+
try {
|
|
17730
|
+
const measured = Math.max(0, Math.abs(Number(current && current.chargeW) || 0) + Math.abs(Number(current && current.dischargeW) || 0));
|
|
17731
|
+
const srcCur = String(current && current.src || '');
|
|
17732
|
+
const missingLike = !current || srcCur === 'missing' || srcCur === 'stale-or-missing';
|
|
17733
|
+
const derived = fromBalance();
|
|
17734
|
+
if (!derived) return current;
|
|
17735
|
+
if (missingLike || measured <= Math.max(180, deadbandW)) return derived;
|
|
17736
|
+
return current;
|
|
17737
|
+
} catch (_ePrefer) {
|
|
17738
|
+
return current;
|
|
17739
|
+
}
|
|
17740
|
+
};
|
|
17741
|
+
|
|
17665
17742
|
// Speicherfarm already provides normalized charge/discharge totals. Keep it authoritative
|
|
17666
17743
|
// unless a signed single battery datapoint is explicitly mapped for a non-farm setup.
|
|
17667
17744
|
const sfEnabled = !!(this.stateCache && this.stateCache['storageFarm.enabled'] && this.stateCache['storageFarm.enabled'].value);
|
|
@@ -17695,7 +17772,7 @@ Technische Details: system.adapter.${c.inst}.alive=false`,
|
|
|
17695
17772
|
// If charge/discharge were both mapped to the same signed datapoint, keep the sign.
|
|
17696
17773
|
// updateValue() normalizes their public state values to magnitudes, so the private raw cache is used here.
|
|
17697
17774
|
if (sameChargeDischargeId && chargeRaw !== null) {
|
|
17698
|
-
return fromSigned(chargeRaw, 'sameChargeDischargeSigned', { mirror: true });
|
|
17775
|
+
return preferBalance(fromSigned(chargeRaw, 'sameChargeDischargeSigned', { mirror: true }));
|
|
17699
17776
|
}
|
|
17700
17777
|
|
|
17701
17778
|
// Canonical single signed DP fallback: exactly like NVP signed handling.
|
|
@@ -17708,7 +17785,7 @@ Technische Details: system.adapter.${c.inst}.alive=false`,
|
|
|
17708
17785
|
const bothEqualish = bothPublicDirections && Math.abs(Math.abs(Number(publicCharge || 0)) - Math.abs(Number(publicDischarge || 0))) <= Math.max(2, deadbandW);
|
|
17709
17786
|
|
|
17710
17787
|
if (batterySigned !== null && (!separateAvailable || bothEqualish || (!chargeMapped && !dischargeMapped))) {
|
|
17711
|
-
return fromSigned(batterySigned, bothEqualish ? 'batterySignedOverrideDual' : 'batterySigned', { mirror: true });
|
|
17788
|
+
return preferBalance(fromSigned(batterySigned, bothEqualish ? 'batterySignedOverrideDual' : 'batterySigned', { mirror: true }));
|
|
17712
17789
|
}
|
|
17713
17790
|
|
|
17714
17791
|
if (separateAvailable) {
|
|
@@ -17719,7 +17796,7 @@ Technische Details: system.adapter.${c.inst}.alive=false`,
|
|
|
17719
17796
|
if (c <= deadbandW) c = 0;
|
|
17720
17797
|
if (d <= deadbandW) d = 0;
|
|
17721
17798
|
if (inv) { const t = c; c = d; d = t; }
|
|
17722
|
-
return {
|
|
17799
|
+
return preferBalance({
|
|
17723
17800
|
chargeW: Math.round(c),
|
|
17724
17801
|
dischargeW: Math.round(d),
|
|
17725
17802
|
signedW: Math.round(d - c),
|
|
@@ -17731,14 +17808,14 @@ Technische Details: system.adapter.${c.inst}.alive=false`,
|
|
|
17731
17808
|
storageChargePower: this._nwGetCacheAgeMs('storageChargePower', now),
|
|
17732
17809
|
storageDischargePower: this._nwGetCacheAgeMs('storageDischargePower', now),
|
|
17733
17810
|
},
|
|
17734
|
-
};
|
|
17811
|
+
});
|
|
17735
17812
|
}
|
|
17736
17813
|
|
|
17737
17814
|
if (batterySigned !== null) {
|
|
17738
|
-
return fromSigned(batterySigned, 'batterySigned', { mirror: true });
|
|
17815
|
+
return preferBalance(fromSigned(batterySigned, 'batterySigned', { mirror: true }));
|
|
17739
17816
|
}
|
|
17740
17817
|
|
|
17741
|
-
return {
|
|
17818
|
+
return preferBalance({
|
|
17742
17819
|
chargeW: 0,
|
|
17743
17820
|
dischargeW: 0,
|
|
17744
17821
|
signedW: 0,
|
|
@@ -17751,7 +17828,7 @@ Technische Details: system.adapter.${c.inst}.alive=false`,
|
|
|
17751
17828
|
storageChargePower: this._nwGetCacheAgeMs('storageChargePower', now),
|
|
17752
17829
|
storageDischargePower: this._nwGetCacheAgeMs('storageDischargePower', now),
|
|
17753
17830
|
},
|
|
17754
|
-
};
|
|
17831
|
+
});
|
|
17755
17832
|
}
|
|
17756
17833
|
|
|
17757
17834
|
_nwResolveGridImportExportFromCache() {
|
|
@@ -19288,7 +19365,7 @@ Technische Details: system.adapter.${c.inst}.alive=false`,
|
|
|
19288
19365
|
if (!Number.isFinite(curC) || curC !== chargeRound) this.updateValue('storageChargePower', chargeRound, ts, { raw: false });
|
|
19289
19366
|
if (!Number.isFinite(curD) || curD !== dischargeRound) this.updateValue('storageDischargePower', dischargeRound, ts, { raw: false });
|
|
19290
19367
|
}
|
|
19291
|
-
if (!this._nwHasMappedDatapoint('batteryPower')) {
|
|
19368
|
+
if (!this._nwHasMappedDatapoint('batteryPower') || (storageFlow && storageFlow.src === 'balanceDerived')) {
|
|
19292
19369
|
const signedRound = Math.round(dischargeW - chargeW);
|
|
19293
19370
|
const curB = Number(this.stateCache?.batteryPower?.value);
|
|
19294
19371
|
if (!Number.isFinite(curB) || curB !== signedRound) this.updateValue('batteryPower', signedRound, ts, { raw: false });
|
package/package.json
CHANGED
package/www/app.js
CHANGED
|
@@ -1037,22 +1037,35 @@ function nwAsBool(v, def) {
|
|
|
1037
1037
|
|
|
1038
1038
|
function nwFeatureMappedRow(row) {
|
|
1039
1039
|
if (!row || row.enabled === false) return false;
|
|
1040
|
+
// Nur echte Ladepunkt-Zuordnungen zählen. Legacy-Aggregate wie consumptionEvcs
|
|
1041
|
+
// oder alte boolesche Flags dürfen eine Kundenanlage ohne Wallbox nicht sichtbar machen.
|
|
1040
1042
|
const fields = ['powerId','energyTotalId','energySessionId','statusId','activeId','onlineId','setCurrentAId','setPowerWId','enableWriteId','lockWriteId','rfidReadId','vehicleSocId'];
|
|
1041
1043
|
return fields.some((key) => String(row[key] || '').trim());
|
|
1042
1044
|
}
|
|
1043
1045
|
|
|
1046
|
+
function nwConfiguredEvcsRows(inputCfg) {
|
|
1047
|
+
const c = inputCfg || window.__nwCfg || {};
|
|
1048
|
+
try {
|
|
1049
|
+
const sc = (c.settingsConfig && typeof c.settingsConfig === 'object') ? c.settingsConfig : {};
|
|
1050
|
+
const fromSettings = Array.isArray(sc.evcsList) ? sc.evcsList : [];
|
|
1051
|
+
const fromRuntime = Array.isArray(c.evcsList) ? c.evcsList : [];
|
|
1052
|
+
const list = fromSettings.length ? fromSettings : fromRuntime;
|
|
1053
|
+
return list.filter(nwFeatureMappedRow);
|
|
1054
|
+
} catch (_e) {
|
|
1055
|
+
return [];
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1044
1059
|
function nwEvcsFeatureFromConfig(inputCfg) {
|
|
1045
1060
|
const c = inputCfg || window.__nwCfg || {};
|
|
1046
1061
|
try {
|
|
1062
|
+
const rows = nwConfiguredEvcsRows(c);
|
|
1047
1063
|
const sc = (c.settingsConfig && typeof c.settingsConfig === 'object') ? c.settingsConfig : {};
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
const list = Array.isArray(sc.evcsList) ? sc.evcsList : [];
|
|
1054
|
-
const mapped = list.some(nwFeatureMappedRow);
|
|
1055
|
-
return Number.isFinite(count) && count > 0 && mapped;
|
|
1064
|
+
const configuredCount = Number(sc.evcsConfiguredCount ?? (c.flowSlots && c.flowSlots.meta && c.flowSlots.meta.evcsConfiguredCount) ?? rows.length);
|
|
1065
|
+
const count = Number(sc.evcsCount ?? window.__nwEvcsCount ?? configuredCount ?? 0);
|
|
1066
|
+
// Strikte Regel: Sichtbar erst ab realem Ladepunkt. Ein altes evcsAvailable=true
|
|
1067
|
+
// ohne gemappte Ladepunkt-Zeile wird bewusst ignoriert.
|
|
1068
|
+
return rows.length > 0 || (Number.isFinite(configuredCount) && configuredCount > 0 && Number.isFinite(count) && count > 0);
|
|
1056
1069
|
} catch (_e) {
|
|
1057
1070
|
return false;
|
|
1058
1071
|
}
|
|
@@ -2037,6 +2050,77 @@ function getConfiguredDatapointId(key) {
|
|
|
2037
2050
|
}
|
|
2038
2051
|
}
|
|
2039
2052
|
|
|
2053
|
+
function getBalanceDerivedBatteryFlow(opts = {}) {
|
|
2054
|
+
try {
|
|
2055
|
+
const deadbandW = Number.isFinite(Number(opts.deadbandW)) ? Math.max(0, Number(opts.deadbandW)) : 180;
|
|
2056
|
+
const st = state || window.latestState || {};
|
|
2057
|
+
const read = (k) => st && st[k] ? st[k].value : undefined;
|
|
2058
|
+
|
|
2059
|
+
// In Speicherfarm-Anlagen sind die Farm-Summen die Quelle der Wahrheit.
|
|
2060
|
+
if (nwAsBool(read('storageFarm.enabled'), false)) return null;
|
|
2061
|
+
|
|
2062
|
+
const soc = coerceNumber(read('storageSoc') ?? read('batterySOC'));
|
|
2063
|
+
if (soc === null) return null;
|
|
2064
|
+
|
|
2065
|
+
// Nur aus der Bilanz ableiten, wenn eine echte Verbrauchsleistung gemappt ist.
|
|
2066
|
+
// Sonst würden wir aus einem bereits abgeleiteten consumptionTotal wieder zurückrechnen.
|
|
2067
|
+
const hasDirectLoad = isMappedDatapoint('consumptionTotal') || isMappedDatapoint('housePower');
|
|
2068
|
+
if (!hasDirectLoad) return null;
|
|
2069
|
+
|
|
2070
|
+
const load = coerceNumber(read('consumptionTotal') ?? read('housePower'));
|
|
2071
|
+
if (load === null) return null;
|
|
2072
|
+
|
|
2073
|
+
const grid = getGridImportExport(read);
|
|
2074
|
+
if (!grid || !grid.hasGridInfo) return null;
|
|
2075
|
+
|
|
2076
|
+
let pv = coerceNumber(read('pvPower'));
|
|
2077
|
+
if (pv === null && isMappedDatapoint('productionTotal')) pv = coerceNumber(read('productionTotal'));
|
|
2078
|
+
if (pv === null) return null;
|
|
2079
|
+
|
|
2080
|
+
let production = Math.max(0, Math.abs(Number(pv) || 0));
|
|
2081
|
+
for (let i = 1; i <= 5; i++) {
|
|
2082
|
+
const p = coerceNumber(read(`producer${i}Power`));
|
|
2083
|
+
if (p !== null) production += Math.max(0, Math.abs(p));
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
const signed = Math.round((Math.max(0, load) - production - Math.max(0, grid.buy || 0) + Math.max(0, grid.sell || 0)));
|
|
2087
|
+
if (!Number.isFinite(signed) || Math.abs(signed) <= deadbandW) return null;
|
|
2088
|
+
|
|
2089
|
+
// Plausibilitätsbremsen gegen kurze Messversätze oder unbekannte Verbraucher.
|
|
2090
|
+
const activity = production + Math.max(0, load) + Math.max(0, grid.buy || 0) + Math.max(0, grid.sell || 0);
|
|
2091
|
+
if (activity < 500) return null;
|
|
2092
|
+
if (Math.abs(signed) > Math.max(3000, activity * 1.15)) return null;
|
|
2093
|
+
if (signed < 0 && soc >= 99.5) return null;
|
|
2094
|
+
if (signed > 0 && soc <= 0.5) return null;
|
|
2095
|
+
|
|
2096
|
+
return {
|
|
2097
|
+
chargeW: signed < 0 ? Math.abs(signed) : 0,
|
|
2098
|
+
dischargeW: signed > 0 ? signed : 0,
|
|
2099
|
+
signedW: signed,
|
|
2100
|
+
src: 'balanceDerived',
|
|
2101
|
+
inverted: false,
|
|
2102
|
+
derived: true
|
|
2103
|
+
};
|
|
2104
|
+
} catch (_e) {
|
|
2105
|
+
return null;
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
function preferBalanceDerivedBatteryFlow(current, opts = {}) {
|
|
2110
|
+
try {
|
|
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
|
+
const src = String(current && current.src || '');
|
|
2114
|
+
const missingLike = !current || src === 'missing' || src === 'stale-or-missing';
|
|
2115
|
+
const derived = getBalanceDerivedBatteryFlow({ deadbandW });
|
|
2116
|
+
if (!derived) return current;
|
|
2117
|
+
if (missingLike || measured <= deadbandW) return derived;
|
|
2118
|
+
return current;
|
|
2119
|
+
} catch (_e) {
|
|
2120
|
+
return current;
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2040
2124
|
function getNormalizedBatteryFlow() {
|
|
2041
2125
|
const deadbandW = 25;
|
|
2042
2126
|
const inv = !!(state && state['settings.flowInvertBattery'] && state['settings.flowInvertBattery'].value);
|
|
@@ -2080,14 +2164,14 @@ function getNormalizedBatteryFlow() {
|
|
|
2080
2164
|
const charge = chargeMapped ? getFreshFlowNumber('storageChargePower') : null;
|
|
2081
2165
|
const discharge = dischargeMapped ? getFreshFlowNumber('storageDischargePower') : null;
|
|
2082
2166
|
|
|
2083
|
-
if (samePair && signedBattery !== null) return fromSigned(signedBattery, 'batterySignedForSamePair');
|
|
2167
|
+
if (samePair && signedBattery !== null) return preferBalanceDerivedBatteryFlow(fromSigned(signedBattery, 'batterySignedForSamePair'), { deadbandW });
|
|
2084
2168
|
|
|
2085
2169
|
const separateAvailable = (charge !== null || discharge !== null);
|
|
2086
2170
|
const bothDirections = Math.abs(Number(charge || 0)) > deadbandW && Math.abs(Number(discharge || 0)) > deadbandW;
|
|
2087
2171
|
const bothEqualish = bothDirections && Math.abs(Math.abs(Number(charge || 0)) - Math.abs(Number(discharge || 0))) <= Math.max(2, deadbandW);
|
|
2088
2172
|
|
|
2089
2173
|
if (signedBattery !== null && (!separateAvailable || bothEqualish || (!chargeMapped && !dischargeMapped))) {
|
|
2090
|
-
return fromSigned(signedBattery, bothEqualish ? 'batterySignedOverrideDual' : 'batterySigned');
|
|
2174
|
+
return preferBalanceDerivedBatteryFlow(fromSigned(signedBattery, bothEqualish ? 'batterySignedOverrideDual' : 'batterySigned'), { deadbandW });
|
|
2091
2175
|
}
|
|
2092
2176
|
|
|
2093
2177
|
if (separateAvailable) {
|
|
@@ -2096,12 +2180,12 @@ function getNormalizedBatteryFlow() {
|
|
|
2096
2180
|
if (c <= deadbandW) c = 0;
|
|
2097
2181
|
if (d <= deadbandW) d = 0;
|
|
2098
2182
|
if (inv) { const t = c; c = d; d = t; }
|
|
2099
|
-
return { chargeW: c, dischargeW: d, signedW: d - c, src: inv ? 'chargeDischarge(inv)' : 'chargeDischarge', inverted: inv };
|
|
2183
|
+
return preferBalanceDerivedBatteryFlow({ chargeW: c, dischargeW: d, signedW: d - c, src: inv ? 'chargeDischarge(inv)' : 'chargeDischarge', inverted: inv }, { deadbandW });
|
|
2100
2184
|
}
|
|
2101
2185
|
|
|
2102
|
-
if (signedBattery !== null) return fromSigned(signedBattery, 'batterySigned');
|
|
2186
|
+
if (signedBattery !== null) return preferBalanceDerivedBatteryFlow(fromSigned(signedBattery, 'batterySigned'), { deadbandW });
|
|
2103
2187
|
|
|
2104
|
-
return { chargeW: 0, dischargeW: 0, signedW: 0, src: (batteryMapped || chargeMapped || dischargeMapped) ? 'stale-or-missing' : 'missing', inverted: inv };
|
|
2188
|
+
return preferBalanceDerivedBatteryFlow({ chargeW: 0, dischargeW: 0, signedW: 0, src: (batteryMapped || chargeMapped || dischargeMapped) ? 'stale-or-missing' : 'missing', inverted: inv }, { deadbandW });
|
|
2105
2189
|
}
|
|
2106
2190
|
|
|
2107
2191
|
function render() {
|
package/www/cockpit-shell.js
CHANGED
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
fetch('/config', { cache: 'no-store' }).then(function(r){ return r.json(); }).then(function(cfg){
|
|
53
53
|
cfg = cfg || {};
|
|
54
54
|
var sc = (cfg.settingsConfig && typeof cfg.settingsConfig === 'object') ? cfg.settingsConfig : {};
|
|
55
|
-
var evAvail =
|
|
55
|
+
var evAvail = ((Number(sc.evcsConfiguredCount || 0) || (Array.isArray(sc.evcsList) ? sc.evcsList.filter(function(r){ if(!r || r.enabled === false) return false; return ['powerId','energyTotalId','energySessionId','statusId','activeId','onlineId','setCurrentAId','setPowerWId','enableWriteId','lockWriteId','rfidReadId','vehicleSocId'].some(function(k){ return String(r[k] || '').trim(); }); }).length : 0)) > 0);
|
|
56
56
|
var evCount = Math.max(0, Math.round(Number(sc.evcsCount || 0) || 0));
|
|
57
57
|
var showEvcs = evAvail && evCount >= 2;
|
|
58
58
|
var sh = !!((cfg.smartHome && cfg.smartHome.enabled) || cfg.smartHomeEnabled);
|
package/www/evcs-report.js
CHANGED
|
@@ -284,7 +284,7 @@ function toISODate(ms){
|
|
|
284
284
|
const settingsConfig = (cfg && cfg.settingsConfig) || {};
|
|
285
285
|
const smartHomeEnabled = !!(cfg && (cfg.smartHomeEnabled || (cfg.smartHome && cfg.smartHome.enabled)));
|
|
286
286
|
const storageFarmEnabled = !!(cfg && ((typeof cfg.storageFarmEnabled === 'boolean') ? cfg.storageFarmEnabled : (cfg.ems && cfg.ems.storageFarmEnabled)));
|
|
287
|
-
const evcsAvailable =
|
|
287
|
+
const evcsAvailable = ((Number(settingsConfig.evcsConfiguredCount || 0) || (Array.isArray(settingsConfig.evcsList) ? settingsConfig.evcsList.filter(function(r){ if(!r || r.enabled === false) return false; return ['powerId','energyTotalId','energySessionId','statusId','activeId','onlineId','setCurrentAId','setPowerWId','enableWriteId','lockWriteId','rfidReadId','vehicleSocId'].some(function(k){ return String(r[k] || '').trim(); }); }).length : 0)) > 0);
|
|
288
288
|
const evcsCount = evcsAvailable ? Math.max(0, Math.round(Number(settingsConfig.evcsCount) || 0)) : 0;
|
|
289
289
|
|
|
290
290
|
const tabEvcs = document.getElementById('tabEvcs');
|
package/www/evcs.js
CHANGED
|
@@ -702,7 +702,7 @@ function render() {
|
|
|
702
702
|
if (!list) return;
|
|
703
703
|
|
|
704
704
|
const sc = (cfg && cfg.settingsConfig) || {};
|
|
705
|
-
const evcsAvailable =
|
|
705
|
+
const evcsAvailable = ((Number(sc.evcsConfiguredCount || 0) || (Array.isArray(sc.evcsList) ? sc.evcsList.filter(function(r){ if(!r || r.enabled === false) return false; return ['powerId','energyTotalId','energySessionId','statusId','activeId','onlineId','setCurrentAId','setPowerWId','enableWriteId','lockWriteId','rfidReadId','vehicleSocId'].some(function(k){ return String(r[k] || '').trim(); }); }).length : 0)) > 0);
|
|
706
706
|
const count = evcsAvailable ? Math.max(0, Math.round(Number(sc.evcsCount) || 0)) : 0;
|
|
707
707
|
const meta = evcsAvailable && Array.isArray(sc.evcsList) ? sc.evcsList : [];
|
|
708
708
|
|
|
@@ -1251,7 +1251,7 @@ async function bootstrap() {
|
|
|
1251
1251
|
try {
|
|
1252
1252
|
cfg = await fetch('/config', { cache: 'no-store' }).then(r => r.json());
|
|
1253
1253
|
const sc = (cfg && cfg.settingsConfig) || {};
|
|
1254
|
-
const evcsAvailable =
|
|
1254
|
+
const evcsAvailable = ((Number(sc.evcsConfiguredCount || 0) || (Array.isArray(sc.evcsList) ? sc.evcsList.filter(function(r){ if(!r || r.enabled === false) return false; return ['powerId','energyTotalId','energySessionId','statusId','activeId','onlineId','setCurrentAId','setPowerWId','enableWriteId','lockWriteId','rfidReadId','vehicleSocId'].some(function(k){ return String(r[k] || '').trim(); }); }).length : 0)) > 0);
|
|
1255
1255
|
const c = evcsAvailable ? Math.max(0, Math.round(Number(sc.evcsCount) || 0)) : 0;
|
|
1256
1256
|
const showEvcsPage = evcsAvailable && c >= 2;
|
|
1257
1257
|
if (!showEvcsPage) {
|
package/www/history.js
CHANGED
|
@@ -2257,7 +2257,7 @@ async function load(force = false){
|
|
|
2257
2257
|
(function(){
|
|
2258
2258
|
fetch('/config', { cache: 'no-store' }).then(r=>r.json()).then(cfg=>{
|
|
2259
2259
|
const sc = (cfg && cfg.settingsConfig) || {};
|
|
2260
|
-
const evcsAvailable =
|
|
2260
|
+
const evcsAvailable = ((Number(sc.evcsConfiguredCount || 0) || (Array.isArray(sc.evcsList) ? sc.evcsList.filter(function(r){ if(!r || r.enabled === false) return false; return ['powerId','energyTotalId','energySessionId','statusId','activeId','onlineId','setCurrentAId','setPowerWId','enableWriteId','lockWriteId','rfidReadId','vehicleSocId'].some(function(k){ return String(r[k] || '').trim(); }); }).length : 0)) > 0);
|
|
2261
2261
|
const c = evcsAvailable ? Math.max(0, Math.round(Number(sc.evcsCount) || 0)) : 0;
|
|
2262
2262
|
const showEvcs = evcsAvailable && c >= 2;
|
|
2263
2263
|
const l = document.getElementById('menuEvcsLink');
|
package/www/logic.js
CHANGED
|
@@ -2909,7 +2909,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
2909
2909
|
}
|
|
2910
2910
|
fetch('/config', { cache: 'no-store' }).then(r=>r.json()).then(cfg=>{
|
|
2911
2911
|
const sc = (cfg && cfg.settingsConfig) || {};
|
|
2912
|
-
const evcsAvailable =
|
|
2912
|
+
const evcsAvailable = ((Number(sc.evcsConfiguredCount || 0) || (Array.isArray(sc.evcsList) ? sc.evcsList.filter(function(r){ if(!r || r.enabled === false) return false; return ['powerId','energyTotalId','energySessionId','statusId','activeId','onlineId','setCurrentAId','setPowerWId','enableWriteId','lockWriteId','rfidReadId','vehicleSocId'].some(function(k){ return String(r[k] || '').trim(); }); }).length : 0)) > 0);
|
|
2913
2913
|
const c = evcsAvailable ? Math.max(0, Math.round(Number(sc.evcsCount) || 0)) : 0;
|
|
2914
2914
|
const showEvcs = evcsAvailable && c >= 2;
|
|
2915
2915
|
const l=document.getElementById('menuEvcsLink');
|
package/www/manifest.webmanifest
CHANGED
package/www/report-common.js
CHANGED
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
const settingsConfig = (cfg && cfg.settingsConfig) || {};
|
|
149
149
|
const smartHomeEnabled = !!(cfg && (cfg.smartHomeEnabled || (cfg.smartHome && cfg.smartHome.enabled)));
|
|
150
150
|
const storageFarmEnabled = !!(cfg && ((typeof cfg.storageFarmEnabled === 'boolean') ? cfg.storageFarmEnabled : (cfg.ems && cfg.ems.storageFarmEnabled)));
|
|
151
|
-
const evcsAvailable =
|
|
151
|
+
const evcsAvailable = ((Number(settingsConfig.evcsConfiguredCount || 0) || (Array.isArray(settingsConfig.evcsList) ? settingsConfig.evcsList.filter(function(r){ if(!r || r.enabled === false) return false; return ['powerId','energyTotalId','energySessionId','statusId','activeId','onlineId','setCurrentAId','setPowerWId','enableWriteId','lockWriteId','rfidReadId','vehicleSocId'].some(function(k){ return String(r[k] || '').trim(); }); }).length : 0)) > 0);
|
|
152
152
|
const evcsCount = evcsAvailable ? Math.max(0, Math.round(Number(settingsConfig.evcsCount) || 0)) : 0;
|
|
153
153
|
const showEvcs = evcsAvailable && evcsCount >= 2;
|
|
154
154
|
|
package/www/smarthome.js
CHANGED
|
@@ -8397,7 +8397,7 @@ async function nwLoadUiConfigFlags() {
|
|
|
8397
8397
|
const cfg = await fetch('/config', { cache: 'no-store' }).then(r => r.json());
|
|
8398
8398
|
|
|
8399
8399
|
const sc = (cfg && cfg.settingsConfig) || {};
|
|
8400
|
-
const evcsAvailable =
|
|
8400
|
+
const evcsAvailable = ((Number(sc.evcsConfiguredCount || 0) || (Array.isArray(sc.evcsList) ? sc.evcsList.filter(function(r){ if(!r || r.enabled === false) return false; return ['powerId','energyTotalId','energySessionId','statusId','activeId','onlineId','setCurrentAId','setPowerWId','enableWriteId','lockWriteId','rfidReadId','vehicleSocId'].some(function(k){ return String(r[k] || '').trim(); }); }).length : 0)) > 0);
|
|
8401
8401
|
nwEvcsCount = evcsAvailable ? Math.max(0, Math.round(Number(sc.evcsCount) || 0)) : 0;
|
|
8402
8402
|
nwSmartHomeEnabled = !!((cfg.smartHome && cfg.smartHome.enabled) || cfg.smartHomeEnabled);
|
|
8403
8403
|
const storageFarmEnabled = (typeof cfg.storageFarmEnabled === 'boolean') ? !!cfg.storageFarmEnabled : !!(cfg.ems && cfg.ems.storageFarmEnabled);
|
package/www/storagefarm.js
CHANGED
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
var evcsCount = Math.max(0, Math.round(Number(settingsConfig.evcsCount) || 0));
|
|
127
127
|
var smartHomeEnabled = !!(cfg && cfg.smartHome && cfg.smartHome.enabled);
|
|
128
128
|
var storageFarmEnabled = (typeof cfg.storageFarmEnabled === 'boolean') ? !!cfg.storageFarmEnabled : !!(ems.storageFarmEnabled || cfg.storageFarmEnabled);
|
|
129
|
-
var evcsAvailable =
|
|
129
|
+
var evcsAvailable = ((Number(settingsConfig.evcsConfiguredCount || 0) || (Array.isArray(settingsConfig.evcsList) ? settingsConfig.evcsList.filter(function(r){ if(!r || r.enabled === false) return false; return ['powerId','energyTotalId','energySessionId','statusId','activeId','onlineId','setCurrentAId','setPowerWId','enableWriteId','lockWriteId','rfidReadId','vehicleSocId'].some(function(k){ return String(r[k] || '').trim(); }); }).length : 0)) > 0);
|
|
130
130
|
var evcsTab = el('tabEvcs');
|
|
131
131
|
var evcsMenu = el('menuEvcsLink');
|
|
132
132
|
var shTab = el('tabSmartHome');
|
package/www/sw.js
CHANGED
package/www/year-report.js
CHANGED
|
@@ -742,7 +742,7 @@
|
|
|
742
742
|
(function(){
|
|
743
743
|
fetch('/config', { cache: 'no-store' }).then(r=>r.json()).then(cfg=>{
|
|
744
744
|
const sc = (cfg && cfg.settingsConfig) || {};
|
|
745
|
-
const evcsAvailable =
|
|
745
|
+
const evcsAvailable = ((Number(sc.evcsConfiguredCount || 0) || (Array.isArray(sc.evcsList) ? sc.evcsList.filter(function(r){ if(!r || r.enabled === false) return false; return ['powerId','energyTotalId','energySessionId','statusId','activeId','onlineId','setCurrentAId','setPowerWId','enableWriteId','lockWriteId','rfidReadId','vehicleSocId'].some(function(k){ return String(r[k] || '').trim(); }); }).length : 0)) > 0);
|
|
746
746
|
const c = evcsAvailable ? Math.max(0, Math.round(Number(sc.evcsCount) || 0)) : 0;
|
|
747
747
|
const showEvcs = evcsAvailable && c >= 2;
|
|
748
748
|
const l = document.getElementById('menuEvcsLink');
|