iobroker.eos-admin 9.0.38 → 9.0.39
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 -10
- package/README.md +10 -2
- package/adminWww/.vite/manifest.json +114 -114
- package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +13759 -13759
- package/adminWww/assets/{AdapterUpdateDialog-D4gUYZep.js → AdapterUpdateDialog-DDmYbnK4.js} +1 -1
- package/adminWww/assets/{Adapters-DLxiJc3y.js → Adapters-73Uo4VUy.js} +1 -1
- package/adminWww/assets/{ConfigManager-D_YTKUdP.js → ConfigManager-DoFx_j4o.js} +1 -1
- package/adminWww/assets/{Enums-D79rON6b.js → Enums-BRQSAW9I.js} +1 -1
- package/adminWww/assets/{Fields-CTOv49EU.js → Fields-pcmISvLk.js} +1 -1
- package/adminWww/assets/{Files-DNLzjEG5.js → Files-E8-7c9Ab.js} +1 -1
- package/adminWww/assets/{Hosts-DHNboUMq.js → Hosts-D4a3shrq.js} +1 -1
- package/adminWww/assets/{Instances-BJxYNJAC.js → Instances-ByxEHRoo.js} +1 -1
- package/adminWww/assets/{Intro-8R-Q7CR_.js → Intro-DFriWa6g.js} +1 -1
- package/adminWww/assets/{Logs-CjAPhWuK.js → Logs-BXR0h5Sz.js} +1 -1
- package/adminWww/assets/{Objects-cvdqooGe.js → Objects-h6jg_6uT.js} +1 -1
- package/adminWww/assets/{Overview-JPfBOuKv.js → Overview-B39PiMGJ.js} +1 -1
- package/adminWww/assets/{State-CGnvMceJ.js → State-CqF2ARx_.js} +1 -1
- package/adminWww/assets/{UsedResources-FBd9jThR.js → UsedResources-CnbnoF3d.js} +1 -1
- package/adminWww/assets/{Users-BbUu3hZj.js → Users-BQik0rIi.js} +1 -1
- package/adminWww/assets/{bootstrap-Df_WTIJg.js → bootstrap-Dllnekqb.js} +3 -3
- package/adminWww/assets/{hostInit-BQCRqFay.js → hostInit-CQbS-SCS.js} +1 -1
- package/adminWww/assets/{icons-material-DS82xOs8.js → icons-material-rYFYu2DM.js} +1 -1
- package/adminWww/assets/{index-BlBZd8r8.js → index-BzbVZbb2.js} +2 -2
- package/adminWww/assets/{installSVGRenderer-BtlXF9y3.js → installSVGRenderer-DbH6B8B8.js} +1 -1
- package/adminWww/assets/{mf-entry-bootstrap-0-8bb11ea2.js → mf-entry-bootstrap-0-4dee1225.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.39.js +12 -0
- package/adminWww/remoteEntry.js +1 -1
- package/docs/README.md +1 -0
- package/docs/reports/EMS_ZIELLADEN_2026-11-28.md +45 -0
- package/docs/reports/unified-9.0.39/PRUEFBERICHT.md +48 -0
- package/docs/reports/unified-9.0.39/raw/INDEX.json +51 -0
- package/docs/reports/unified-9.0.39/raw/node22-tests-final.log +18189 -0
- package/docs/reports/unified-9.0.39/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.39/raw/node24-tests-final.log +3129 -0
- package/docs/reports/unified-9.0.39/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.39/raw/npm-runtime-audit.json +77 -0
- package/docs/reports/unified-9.0.39/raw/overnight-simulation.json +117 -0
- package/docs/start/START_HIER_9.0.39.md +14 -0
- package/io-package.json +8 -8
- package/modules/ocpp/README.md +2 -0
- package/modules/ocpp/ocpp/common.js +64 -40
- package/modules/ocpp/ocpp/eos-contract.js +8 -3
- package/modules/ocpp/runtime.js +10 -5
- package/modules/ocpp/test/eos-contract.test.js +67 -0
- package/modules/ocpp/test/hosted.test.cjs +29 -1
- package/package.json +7 -3
- package/release-manifests/unified/build-environment.cdx.json +6 -6
- package/release-manifests/unified/files.json +123 -109
- 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 +83 -0
- package/release-manifests/unified/runtime.cdx.json +27 -27
- package/release-manifests/unified/validation.json +17 -17
- package/tools/eos-release-manifest.cjs +2 -0
- package/ui/docs/STATES_AND_DATAPOINTS_DE.md +132 -0
- package/ui/ems/engine.js +5 -3
- package/ui/ems/evcs-control-mapping.js +13 -1
- package/ui/ems/modules/charging-management.js +40 -76
- package/ui/ems/services/admin-overview-publisher.js +13 -7
- package/ui/ems/services/charging-management-audit.js +32 -1
- package/ui/ems/services/forecast-aware-target-planner.js +12 -5
- package/ui/ems/services/forecast-target-runtime-bridge.js +12 -5
- package/ui/io-package.json +5 -1
- package/ui/lib/charging-point-identity.js +91 -16
- package/ui/lib/hosted-adapter.js +35 -1
- package/ui/main.js +69 -41
- package/ui/package.json +1 -1
- package/ui/www/app.js +57 -72
- package/ui/www/charging-diagnostics-appcenter.js +12 -7
- package/ui/www/dashboard-lp-status.js +19 -12
- package/ui/www/evcs.js +71 -98
- package/ui/www/licenses/smarthome-markdown-components.json +156 -156
- package/ui/www/manifest.webmanifest +2 -2
- package/adminWww/remoteEntry-eos-9.0.38.js +0 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v24.22.1
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"auditReportVersion": 2,
|
|
3
|
+
"vulnerabilities": {
|
|
4
|
+
"ajv": {
|
|
5
|
+
"name": "ajv",
|
|
6
|
+
"severity": "moderate",
|
|
7
|
+
"isDirect": false,
|
|
8
|
+
"via": [
|
|
9
|
+
{
|
|
10
|
+
"source": 1113715,
|
|
11
|
+
"name": "ajv",
|
|
12
|
+
"dependency": "ajv",
|
|
13
|
+
"title": "ajv has ReDoS when using `$data` option",
|
|
14
|
+
"url": "https://github.com/advisories/GHSA-2g4f-4pwh-qvx6",
|
|
15
|
+
"severity": "moderate",
|
|
16
|
+
"cwe": [
|
|
17
|
+
"CWE-400",
|
|
18
|
+
"CWE-1333"
|
|
19
|
+
],
|
|
20
|
+
"cvss": {
|
|
21
|
+
"score": 0,
|
|
22
|
+
"vectorString": null
|
|
23
|
+
},
|
|
24
|
+
"range": ">=7.0.0-alpha.0 <8.18.0"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"effects": [
|
|
28
|
+
"ocpp-rpc"
|
|
29
|
+
],
|
|
30
|
+
"range": "7.0.0-alpha.0 - 8.17.1",
|
|
31
|
+
"nodes": [
|
|
32
|
+
"node_modules/ocpp-rpc/node_modules/ajv"
|
|
33
|
+
],
|
|
34
|
+
"fixAvailable": {
|
|
35
|
+
"name": "ocpp-rpc",
|
|
36
|
+
"version": "2.1.1",
|
|
37
|
+
"isSemVerMajor": true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"ocpp-rpc": {
|
|
41
|
+
"name": "ocpp-rpc",
|
|
42
|
+
"severity": "moderate",
|
|
43
|
+
"isDirect": true,
|
|
44
|
+
"via": [
|
|
45
|
+
"ajv"
|
|
46
|
+
],
|
|
47
|
+
"effects": [],
|
|
48
|
+
"range": ">=2.1.2",
|
|
49
|
+
"nodes": [
|
|
50
|
+
"node_modules/ocpp-rpc"
|
|
51
|
+
],
|
|
52
|
+
"fixAvailable": {
|
|
53
|
+
"name": "ocpp-rpc",
|
|
54
|
+
"version": "2.1.1",
|
|
55
|
+
"isSemVerMajor": true
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"metadata": {
|
|
60
|
+
"vulnerabilities": {
|
|
61
|
+
"info": 0,
|
|
62
|
+
"low": 0,
|
|
63
|
+
"moderate": 2,
|
|
64
|
+
"high": 0,
|
|
65
|
+
"critical": 0,
|
|
66
|
+
"total": 2
|
|
67
|
+
},
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"prod": 373,
|
|
70
|
+
"dev": 477,
|
|
71
|
+
"optional": 68,
|
|
72
|
+
"peer": 362,
|
|
73
|
+
"peerOptional": 0,
|
|
74
|
+
"total": 928
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": 1,
|
|
3
|
+
"scope": "Synthetic overnight EVCS closed-loop run; shipped regulator computes the current and the simulator reports back charger power and vehicle SoC each minute. No physical hardware.",
|
|
4
|
+
"sourceVersion": "9.0.38",
|
|
5
|
+
"targetVersion": "9.0.39",
|
|
6
|
+
"sourceRegistrySha256": "b8da0796e1e750fe684e914e7b7230f87e66bcf32a876cf9c9e574fe636c4879",
|
|
7
|
+
"targetDistribution": "published 9.0.38 with the changed built runtime files and new manifests overlaid",
|
|
8
|
+
"operatingSystem": "unprivileged Ubuntu Linux x64 in WSL",
|
|
9
|
+
"testDriverSha256": "72a538feb237942cfeee2f29d7c0c4c34e251b799f212e33e08fa16c12130501",
|
|
10
|
+
"simulatorSha256": "5103c30ccd8c56b248ae1ba4fbabecdc59b33b97f6b1066f85b3eae7282e88b7",
|
|
11
|
+
"runs": [
|
|
12
|
+
{
|
|
13
|
+
"package": "9.0.38",
|
|
14
|
+
"node": "v22.23.4",
|
|
15
|
+
"platform": "linux",
|
|
16
|
+
"timezone": "Europe/Berlin",
|
|
17
|
+
"initialLocal": "28.11.26, 01:00:00",
|
|
18
|
+
"deadlineLocal": "28.11.26, 07:00:00",
|
|
19
|
+
"stepSeconds": 60,
|
|
20
|
+
"regulatorTicks": 360,
|
|
21
|
+
"chargerRatedW": 11000,
|
|
22
|
+
"siteLimitW": 4600,
|
|
23
|
+
"pvW": 0,
|
|
24
|
+
"capacityKwh": 60,
|
|
25
|
+
"initialSocPct": 50,
|
|
26
|
+
"goalSocPct": 70,
|
|
27
|
+
"tariffOverride": "forecast",
|
|
28
|
+
"sourceTariffAllowsGrid": false,
|
|
29
|
+
"firstNonzeroWriterLocal": "28.11.26, 05:38:00",
|
|
30
|
+
"firstReachedGoalLocal": null,
|
|
31
|
+
"lastNonzeroMinuteLocal": "28.11.26, 06:59:00",
|
|
32
|
+
"peakActualW": 4485,
|
|
33
|
+
"finalSocPct": 60.2063,
|
|
34
|
+
"modeAfterRun": "auto",
|
|
35
|
+
"model": "3x230 V, actualW=min(siteLimitW,setCurrentA*690), fresh vehicle SoC and grid meter each minute, ideal no-loss battery",
|
|
36
|
+
"physicalHardware": false
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"package": "9.0.39",
|
|
40
|
+
"node": "v22.23.4",
|
|
41
|
+
"platform": "linux",
|
|
42
|
+
"timezone": "Europe/Berlin",
|
|
43
|
+
"initialLocal": "28.11.26, 01:00:00",
|
|
44
|
+
"deadlineLocal": "28.11.26, 07:00:00",
|
|
45
|
+
"stepSeconds": 60,
|
|
46
|
+
"regulatorTicks": 360,
|
|
47
|
+
"chargerRatedW": 11000,
|
|
48
|
+
"siteLimitW": 4600,
|
|
49
|
+
"pvW": 0,
|
|
50
|
+
"capacityKwh": 60,
|
|
51
|
+
"initialSocPct": 50,
|
|
52
|
+
"goalSocPct": 70,
|
|
53
|
+
"tariffOverride": "forecast",
|
|
54
|
+
"sourceTariffAllowsGrid": false,
|
|
55
|
+
"firstNonzeroWriterLocal": "28.11.26, 03:58:00",
|
|
56
|
+
"firstReachedGoalLocal": "28.11.26, 06:53:00",
|
|
57
|
+
"lastNonzeroMinuteLocal": "28.11.26, 06:52:00",
|
|
58
|
+
"peakActualW": 4278,
|
|
59
|
+
"finalSocPct": 70.1097,
|
|
60
|
+
"modeAfterRun": "auto",
|
|
61
|
+
"model": "3x230 V, actualW=min(siteLimitW,setCurrentA*690), fresh vehicle SoC and grid meter each minute, ideal no-loss battery",
|
|
62
|
+
"physicalHardware": false
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"package": "9.0.38",
|
|
66
|
+
"node": "v24.22.1",
|
|
67
|
+
"platform": "linux",
|
|
68
|
+
"timezone": "Europe/Berlin",
|
|
69
|
+
"initialLocal": "28.11.26, 01:00:00",
|
|
70
|
+
"deadlineLocal": "28.11.26, 07:00:00",
|
|
71
|
+
"stepSeconds": 60,
|
|
72
|
+
"regulatorTicks": 360,
|
|
73
|
+
"chargerRatedW": 11000,
|
|
74
|
+
"siteLimitW": 4600,
|
|
75
|
+
"pvW": 0,
|
|
76
|
+
"capacityKwh": 60,
|
|
77
|
+
"initialSocPct": 50,
|
|
78
|
+
"goalSocPct": 70,
|
|
79
|
+
"tariffOverride": "forecast",
|
|
80
|
+
"sourceTariffAllowsGrid": false,
|
|
81
|
+
"firstNonzeroWriterLocal": "28.11.26, 05:38:00",
|
|
82
|
+
"firstReachedGoalLocal": null,
|
|
83
|
+
"lastNonzeroMinuteLocal": "28.11.26, 06:59:00",
|
|
84
|
+
"peakActualW": 4485,
|
|
85
|
+
"finalSocPct": 60.2063,
|
|
86
|
+
"modeAfterRun": "auto",
|
|
87
|
+
"model": "3x230 V, actualW=min(siteLimitW,setCurrentA*690), fresh vehicle SoC and grid meter each minute, ideal no-loss battery",
|
|
88
|
+
"physicalHardware": false
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"package": "9.0.39",
|
|
92
|
+
"node": "v24.22.1",
|
|
93
|
+
"platform": "linux",
|
|
94
|
+
"timezone": "Europe/Berlin",
|
|
95
|
+
"initialLocal": "28.11.26, 01:00:00",
|
|
96
|
+
"deadlineLocal": "28.11.26, 07:00:00",
|
|
97
|
+
"stepSeconds": 60,
|
|
98
|
+
"regulatorTicks": 360,
|
|
99
|
+
"chargerRatedW": 11000,
|
|
100
|
+
"siteLimitW": 4600,
|
|
101
|
+
"pvW": 0,
|
|
102
|
+
"capacityKwh": 60,
|
|
103
|
+
"initialSocPct": 50,
|
|
104
|
+
"goalSocPct": 70,
|
|
105
|
+
"tariffOverride": "forecast",
|
|
106
|
+
"sourceTariffAllowsGrid": false,
|
|
107
|
+
"firstNonzeroWriterLocal": "28.11.26, 03:58:00",
|
|
108
|
+
"firstReachedGoalLocal": "28.11.26, 06:53:00",
|
|
109
|
+
"lastNonzeroMinuteLocal": "28.11.26, 06:52:00",
|
|
110
|
+
"peakActualW": 4278,
|
|
111
|
+
"finalSocPct": 70.1097,
|
|
112
|
+
"modeAfterRun": "auto",
|
|
113
|
+
"model": "3x230 V, actualW=min(siteLimitW,setCurrentA*690), fresh vehicle SoC and grid meter each minute, ideal no-loss battery",
|
|
114
|
+
"physicalHardware": false
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# EOS 9.0.39 · Wallbox-Automatik und Zielladen
|
|
2
|
+
|
|
3
|
+
Diese Version korrigiert zwei Ursachen für ausgebliebenes Zielladen. Beim Wiedererkennen derselben Wallbox bleiben Modus und Ladeziel erhalten. Bei der Wahl des spätesten Netzladestarts berücksichtigt EOS dauerhaft wirksame Leistungsgrenzen von Station und Standort.
|
|
4
|
+
|
|
5
|
+
## Prüfung auf der Hausanlage
|
|
6
|
+
|
|
7
|
+
1. Vor dem Update den Anlagenstand sichern. Für den betroffenen Anschluss Wallboxzuordnung, gewählten Modus, Zieluhrzeit, Ziel-SoC und Fahrzeugkapazität festhalten. Auf einer übernommenen Anlage die bisherigen Einzelinstanzen installiert und deaktiviert lassen.
|
|
8
|
+
2. Nach dem Neustart denselben Anschluss öffnen. Bei beabsichtigtem Zielladen müssen `userMode=auto`, das aktivierte Ziel und die gewünschte lokale Uhrzeit angezeigt werden. Ein bereits früher überschriebener Bedienwunsch kann nur durch erneutes Auswählen von **Auto** wiederhergestellt werden.
|
|
9
|
+
3. Einen Nachtversuch mit angeschlossenem Fahrzeug und frischem Fahrzeug-SoC durchführen. Tarifvorgabe, Standortgrenze und Gerätefreigabe dokumentieren. Der aktuelle Untermodus darf vor dem errechneten Start `PV` anzeigen. Zum Start den EMS-Sollwert mit der von der Wallbox gemessenen Leistung vergleichen. Zur Abfahrt den erreichten Fahrzeug-SoC prüfen.
|
|
10
|
+
4. Nach einer Altadapter-Übernahme im Admin die **EMS-Live-Diagnose** öffnen. Zeitstempel und eingehende Werte mit dem laufenden EMS vergleichen. Für den Verlauf denselben historischen Datenpunkt vor und nach dem Wechsel abfragen.
|
|
11
|
+
|
|
12
|
+
Bei einer Abweichung Zeitpunkt und Ladeprotokoll sichern. Der geprüfte Rückfallweg der Anlage und die bestehende Sicherung werden vor dem Versuch benötigt. Die Freigabe für Kunden setzt die erfolgreiche Erprobung auf der Hausanlage voraus.
|
|
13
|
+
|
|
14
|
+
[Prüfbericht zu Version 9.0.39](../reports/unified-9.0.39/PRUEFBERICHT.md)
|
package/io-package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "eos-admin",
|
|
4
|
-
"version": "9.0.
|
|
4
|
+
"version": "9.0.39",
|
|
5
5
|
"titleLang": {
|
|
6
6
|
"en": "NexoWatt EOS",
|
|
7
7
|
"de": "NexoWatt EOS",
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
"connectionType": "local",
|
|
19
19
|
"dataSource": "push",
|
|
20
20
|
"news": {
|
|
21
|
+
"9.0.39": {
|
|
22
|
+
"de": "EOS erhält Modus und Ladeziel derselben Wallbox und berücksichtigt feste Leistungsgrenzen beim Ladestart. Im Energiefluss zählen gemessene OCPP-Leistung und gemeinsame Stationszähler mit ihrer Messzeit. Im Ladeprotokoll sind Anforderung und Istleistung unterscheidbar. Die EMS-Diagnose steht nach der Bestandsübernahme auch im Admin bereit.",
|
|
23
|
+
"en": "EOS preserves the charging mode and departure target for the same connector and accounts for fixed power limits when scheduling. The energy flow uses timestamped OCPP measurements and counts shared meters once. The charging log distinguishes requested and measured power. Admin shows EMS diagnostics after migration."
|
|
24
|
+
},
|
|
21
25
|
"9.0.38": {
|
|
22
26
|
"de": "Die Bestandsübernahme lässt sich im Admin starten oder erneut prüfen. Auch bei bereits beendeten Altadaptern prüft EOS Konfiguration und Historienanbindung.",
|
|
23
27
|
"en": "Administrators can start or recheck migration. EOS checks the configuration and history connection even when the legacy adapters have already stopped."
|
|
@@ -93,10 +97,6 @@
|
|
|
93
97
|
"9.0.20": {
|
|
94
98
|
"en": "Fix browser-independent device commands, storage-farm feedback and dynamic limits; add direct InfluxDB 2 history with protected credentials and improve login/home-screen icons. Preserve customer configuration.",
|
|
95
99
|
"de": "Gerätebefehle unabhängig vom Browser, Farm-Rückmeldungen und dynamische Grenzen korrigiert; direkte InfluxDB-2-Historie sowie Login- und Home-Bildschirm-Symbole ergänzt. Kundeneinstellungen bleiben erhalten."
|
|
96
|
-
},
|
|
97
|
-
"9.0.19": {
|
|
98
|
-
"en": "Fix device-to-EMS commissioning, fresh unchanged measurements and energy flow; preserve existing customer settings.",
|
|
99
|
-
"de": "Geräteübergabe ins EMS, Aktualität unveränderter Messwerte und Energiefluss korrigiert; bestehende Kundeneinstellungen erhalten."
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
102
|
"desc": {
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
"icon": "admin.svg",
|
|
135
135
|
"messagebox": true,
|
|
136
136
|
"enabled": true,
|
|
137
|
-
"extIcon": "https://unpkg.com/iobroker.eos-admin@9.0.
|
|
137
|
+
"extIcon": "https://unpkg.com/iobroker.eos-admin@9.0.39/admin/admin.svg",
|
|
138
138
|
"keywords": [
|
|
139
139
|
"NexoWatt",
|
|
140
140
|
"EOS",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"licensed"
|
|
146
146
|
],
|
|
147
147
|
"compact": false,
|
|
148
|
-
"readme": "https://unpkg.com/iobroker.eos-admin@9.0.
|
|
148
|
+
"readme": "https://unpkg.com/iobroker.eos-admin@9.0.39/README.md",
|
|
149
149
|
"authors": [
|
|
150
150
|
"NexoWatt"
|
|
151
151
|
],
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
"type": "general",
|
|
158
158
|
"licenseInformation": {
|
|
159
159
|
"type": "paid",
|
|
160
|
-
"link": "https://unpkg.com/iobroker.eos-admin@9.0.
|
|
160
|
+
"link": "https://unpkg.com/iobroker.eos-admin@9.0.39/LICENSE"
|
|
161
161
|
},
|
|
162
162
|
"logTransporter": true,
|
|
163
163
|
"stopBeforeUpdate": true,
|
package/modules/ocpp/README.md
CHANGED
|
@@ -32,6 +32,8 @@ Die neue Prozessgrenze begrenzt Stationsidentitäten auf 128 Zeichen, 256 versch
|
|
|
32
32
|
|
|
33
33
|
## Regelleistung und EMS-Ausfall
|
|
34
34
|
|
|
35
|
+
Bei einer OCPP-Nachricht mit unterschiedlich datierten Messwerten übernimmt EOS die jüngste gültige Probe je Messgröße. Ein jüngerer Energiezähler oder SoC-Wert erhält keine neue Leistungszeit. Zeitgleiche Phasenleistungen können zusammengezählt werden. Der ioBroker-Zeitstempel von `measurements.powerW` und der Inhalt von `health.lastPowerValue` bezeichnen bei einer gemessenen Leistung den Gerätezeitpunkt. Bei einer Summe aus mehreren Anschlüssen gilt der älteste beteiligte Messwert. Der Test des erhaltenen Namensraums `ocpp21.N` verwendet dieselben nativen Stationsdatenpunkte wie eine neue integrierte Anlage.
|
|
36
|
+
|
|
35
37
|
Die vorhandene Stationsregelung ist stationsweit: ein Regelobjekt pro physischer Station. Mehrere Stecker sind keine unabhängigen Regler. Wattvorgaben bleiben Watt; ein echtes Nullprofil wird nicht auf einen Mindeststrom angehoben. Eine Eingangsbestätigung des ioBroker-States bestätigt allein noch keine physische Umsetzung.
|
|
36
38
|
|
|
37
39
|
`control.chargeLimitStatus` ist die atomare Rückmeldung mit Schema 1, aktuellem `sessionId`, `requestedW`, `appliedW`, `appliedAtMs`, `updatedAtMs`, `valid`, `reason` und `error`. Nur eine passend zur aktuellen Verbindung erhaltene `Accepted`-Antwort bestätigt das Profil. Andere Konfigurationsantworten erzeugen keine Leistungsbestätigung. Zurückgewiesene, abgelaufene oder veraltete Antworten dürfen keine alte gültige Leistungsrückmeldung wiederherstellen.
|
|
@@ -340,21 +340,22 @@ function _readUnitAndMultiplier(sample, protocol, measurand) {
|
|
|
340
340
|
// can destabilize load management. Only a fully omitted SampledValue keeps
|
|
341
341
|
// the protocol default Energy.Active.Import.Register in Wh.
|
|
342
342
|
const unit = explicitUnit || canonicalUnit || 'Wh';
|
|
343
|
+
const rawMultiplier = (protocol === 'ocpp1.6' ? sample.multiplier : uom.multiplier ?? sample.multiplier) ?? 0;
|
|
344
|
+
const multiplier = typeof rawMultiplier === 'number' || (typeof rawMultiplier === 'string' && /^[+-]?\d+$/.test(rawMultiplier.trim()))
|
|
345
|
+
? Number(rawMultiplier) : NaN;
|
|
343
346
|
return {
|
|
344
347
|
unit,
|
|
345
348
|
explicitUnit: !!explicitUnit,
|
|
346
|
-
multiplier
|
|
349
|
+
multiplier,
|
|
347
350
|
};
|
|
348
351
|
}
|
|
349
352
|
|
|
350
|
-
function _readNumericValue(sample,
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
if (raw === undefined || raw === null || String(raw).trim() === '') return undefined;
|
|
353
|
+
function _readNumericValue(sample, multiplier) {
|
|
354
|
+
const raw = sample?.value;
|
|
355
|
+
if (typeof raw !== 'number' && !(typeof raw === 'string' && /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(raw.trim()))) return undefined;
|
|
354
356
|
const num = Number(raw);
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
const val = num * Math.pow(10, mul);
|
|
357
|
+
if (!Number.isFinite(num) || !Number.isSafeInteger(multiplier)) return undefined;
|
|
358
|
+
const val = num * Math.pow(10, multiplier);
|
|
358
359
|
return Number.isFinite(val) ? val : undefined;
|
|
359
360
|
}
|
|
360
361
|
|
|
@@ -365,8 +366,8 @@ function extractEnergyImportRegisterWh(meterValueArray, protocol) {
|
|
|
365
366
|
for (const sv of samples) {
|
|
366
367
|
const meas = _readMeasurand(sv, protocol);
|
|
367
368
|
if (meas.toLowerCase().includes('energy.active.import.register')) {
|
|
368
|
-
const rawUnit = _readUnitAndMultiplier(sv, protocol, meas)
|
|
369
|
-
const rawVal = _readNumericValue(sv,
|
|
369
|
+
const { unit: rawUnit, multiplier } = _readUnitAndMultiplier(sv, protocol, meas);
|
|
370
|
+
const rawVal = _readNumericValue(sv, multiplier);
|
|
370
371
|
if (!Number.isFinite(rawVal)) continue;
|
|
371
372
|
const conv = baseUnit(rawVal, rawUnit);
|
|
372
373
|
// We store energy in Wh.
|
|
@@ -393,6 +394,45 @@ function _metricCategory(measurand, unit) {
|
|
|
393
394
|
return 'realtime';
|
|
394
395
|
}
|
|
395
396
|
|
|
397
|
+
/** Select the newest usable reading per measurand within this connector/EVSE call.
|
|
398
|
+
* Keep phase sets together at their actual sample time. Non-contract vendor metrics
|
|
399
|
+
* keep their existing newest-frame behavior. One batch produces one station snapshot. */
|
|
400
|
+
function meterRecords(supplied, protocol, scoped, allowInlet, receiveTime, maxAge) {
|
|
401
|
+
const records = [];
|
|
402
|
+
const latest = new Map();
|
|
403
|
+
let newestFrame = -Infinity;
|
|
404
|
+
for (const frame of supplied) {
|
|
405
|
+
const time = Date.parse(frame?.timestamp);
|
|
406
|
+
if (scoped && (!Number.isFinite(time) || time > receiveTime + 30000 || receiveTime - time > maxAge)) continue;
|
|
407
|
+
if (!Array.isArray(frame?.sampledValue)) continue;
|
|
408
|
+
const readings = [];
|
|
409
|
+
for (const sample of frame.sampledValue) {
|
|
410
|
+
const measurand = _readMeasurand(sample, protocol);
|
|
411
|
+
const { unit, multiplier } = _readUnitAndMultiplier(sample, protocol, measurand);
|
|
412
|
+
const raw = _readNumericValue(sample, multiplier);
|
|
413
|
+
if (!Number.isFinite(raw)) continue;
|
|
414
|
+
const conv = baseUnit(raw, unit);
|
|
415
|
+
const expected = canonicalUnitForMeasurand(measurand);
|
|
416
|
+
if (!Number.isFinite(conv.val) || (['W','A','Wh','V','%'].includes(expected) && conv.unit !== expected)) continue;
|
|
417
|
+
if (measurand === 'SoC' && (conv.val < 0 || conv.val > 100)) continue;
|
|
418
|
+
const managed = scoped && isManaged(measurementDefinition(measurand, sample.phase).key);
|
|
419
|
+
// The location filter also applies to optional detail fields outside the aggregate.
|
|
420
|
+
if (scoped && ['Power.Active.Import','Power.Active.Export','Current.Import','Current.Export','Energy.Active.Import.Register','Energy.Active.Export.Register'].includes(measurand)
|
|
421
|
+
&& sample.location && !['Outlet','Cable','EV'].includes(sample.location)
|
|
422
|
+
&& !(allowInlet && sample.location === 'Inlet')) continue;
|
|
423
|
+
if (managed && time > (latest.get(measurand) ?? -Infinity)) latest.set(measurand, time);
|
|
424
|
+
readings.push({ sample, measurand, conv, managed });
|
|
425
|
+
}
|
|
426
|
+
records.push({ timestamp: frame.timestamp, time, readings });
|
|
427
|
+
if (time > newestFrame) newestFrame = time;
|
|
428
|
+
}
|
|
429
|
+
if (!scoped) return records;
|
|
430
|
+
for (const record of records) {
|
|
431
|
+
record.readings = record.readings.filter(reading => record.time === (reading.managed ? latest.get(reading.measurand) : newestFrame));
|
|
432
|
+
}
|
|
433
|
+
return records.filter(record => record.readings.length).sort((a, b) => a.time - b.time);
|
|
434
|
+
}
|
|
435
|
+
|
|
396
436
|
async function applyMeterValues(ctx, identity, evseId, connectorId, meterValueArray, protocol) {
|
|
397
437
|
if (!ctx || (!ctx.setStateFreshAsync && !ctx.setStateChangedAsync) || !ctx.states) return;
|
|
398
438
|
const id = identity;
|
|
@@ -400,26 +440,21 @@ async function applyMeterValues(ctx, identity, evseId, connectorId, meterValueAr
|
|
|
400
440
|
const receiveTime = Date.now();
|
|
401
441
|
const maxAge = Math.max(15, Number(ctx.config?.telemetryMaxAgeSec) || 90) * 1000;
|
|
402
442
|
const supplied = Array.isArray(meterValueArray) ? meterValueArray : [];
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
let arr = supplied;
|
|
406
|
-
if (scoped) {
|
|
407
|
-
arr = supplied.filter(v => { const t = Date.parse(v?.timestamp); return Number.isFinite(t) && t <= receiveTime + 30000 && receiveTime - t <= maxAge; });
|
|
408
|
-
if (!arr.length) return;
|
|
409
|
-
const latest = Math.max(...arr.map(v => Date.parse(v.timestamp)));
|
|
410
|
-
arr = arr.filter(v => Date.parse(v.timestamp) === latest);
|
|
411
|
-
}
|
|
443
|
+
const arr = meterRecords(supplied, protocol, scoped, evseId === 0 || connectorId === 0, receiveTime, maxAge);
|
|
444
|
+
if (scoped && !arr.length) return;
|
|
412
445
|
const values = {};
|
|
413
446
|
let sourceAt = receiveTime;
|
|
414
447
|
if (scoped) {
|
|
415
|
-
sourceAt = Math.min(receiveTime, Date.parse(arr[0].timestamp));
|
|
416
448
|
const original = ctx;
|
|
417
449
|
const prefix = `${id}.measurements.`;
|
|
418
450
|
ctx = { ...original, setStateFreshAsync: async (stateId, val, ack, category) => {
|
|
419
451
|
if (stateId.startsWith(prefix) && isManaged(stateId.slice(prefix.length))) {
|
|
420
452
|
values[stateId.slice(prefix.length)] = { val, category, sourceAt }; return;
|
|
421
453
|
}
|
|
422
|
-
if (original.setStateFreshAsync)
|
|
454
|
+
if (original.setStateFreshAsync) {
|
|
455
|
+
const measuredAt = ['realtime', 'counter', 'soc'].includes(category) ? sourceAt : undefined;
|
|
456
|
+
return original.setStateFreshAsync(stateId, val, ack, category, measuredAt);
|
|
457
|
+
}
|
|
423
458
|
return original.setStateChangedAsync(stateId, val, ack);
|
|
424
459
|
} };
|
|
425
460
|
}
|
|
@@ -457,7 +492,8 @@ async function applyMeterValues(ctx, identity, evseId, connectorId, meterValueAr
|
|
|
457
492
|
};
|
|
458
493
|
|
|
459
494
|
for (const mv of arr) {
|
|
460
|
-
const ts =
|
|
495
|
+
const ts = mv.timestamp || new Date().toISOString();
|
|
496
|
+
if (scoped) sourceAt = Math.min(receiveTime, mv.time);
|
|
461
497
|
const parsedTs = Date.parse(ts);
|
|
462
498
|
if (Number.isFinite(parsedTs) && parsedTs >= latestTsMs) {
|
|
463
499
|
latestTsMs = parsedTs;
|
|
@@ -465,29 +501,16 @@ async function applyMeterValues(ctx, identity, evseId, connectorId, meterValueAr
|
|
|
465
501
|
} else if (!latestTs) {
|
|
466
502
|
latestTs = ts;
|
|
467
503
|
}
|
|
468
|
-
if (connectorBase) {
|
|
504
|
+
if (connectorBase && (!scoped || mv === arr.at(-1))) {
|
|
469
505
|
const connectorTsId = connectorBase.endsWith('.meter') ? `${connectorBase}.lastTs` : `${connectorBase}.lastUpdate`;
|
|
470
506
|
await _writeState(ctx, connectorTsId, ts, 'status');
|
|
471
507
|
}
|
|
472
|
-
if (typeof ctx.states.ensureMeasurementState === 'function') {
|
|
508
|
+
if (typeof ctx.states.ensureMeasurementState === 'function' && (!scoped || mv === arr.at(-1))) {
|
|
473
509
|
const stationTsId = await ctx.states.ensureTextMeasurementState(id, 'lastUpdate', 'Letzte Messwertaktualisierung', 'value.time');
|
|
474
510
|
await _writeState(ctx, stationTsId, ts, 'status');
|
|
475
511
|
}
|
|
476
512
|
|
|
477
|
-
const
|
|
478
|
-
for (const sv of samples) {
|
|
479
|
-
const measurand = _readMeasurand(sv, protocol);
|
|
480
|
-
const rawUnit = _readUnitAndMultiplier(sv, protocol, measurand).unit;
|
|
481
|
-
const rawVal = _readNumericValue(sv, protocol, measurand);
|
|
482
|
-
if (!Number.isFinite(rawVal)) continue;
|
|
483
|
-
const conv = baseUnit(rawVal, rawUnit);
|
|
484
|
-
if (!Number.isFinite(conv.val)) continue;
|
|
485
|
-
const expected = canonicalUnitForMeasurand(measurand);
|
|
486
|
-
if (['W','A','Wh','V','%'].includes(expected) && conv.unit !== expected) continue;
|
|
487
|
-
if (measurand === 'SoC' && (conv.val < 0 || conv.val > 100)) continue;
|
|
488
|
-
// Do not mix energy from inlet/body with outlet samples or sum line-to-line phases.
|
|
489
|
-
if (scoped && ['Power.Active.Import','Power.Active.Export','Current.Import','Current.Export','Energy.Active.Import.Register','Energy.Active.Export.Register'].includes(measurand) && sv.location && !['Outlet','Cable','EV', ...(evseId === 0 || connectorId === 0 ? ['Inlet'] : [])].includes(sv.location)) continue;
|
|
490
|
-
|
|
513
|
+
for (const { sample: sv, measurand, conv } of mv.readings) {
|
|
491
514
|
validSampleCount++;
|
|
492
515
|
const measurandName = String(measurand);
|
|
493
516
|
if (/^(?:Power\.(?:Active|Reactive)\.(?:Import|Export)|Current\.(?:Import|Export))$/.test(measurandName)) {
|
|
@@ -543,7 +566,7 @@ async function applyMeterValues(ctx, identity, evseId, connectorId, meterValueAr
|
|
|
543
566
|
if (!phaseKey) {
|
|
544
567
|
totalSeen.add(measurandName);
|
|
545
568
|
} else {
|
|
546
|
-
if (!phaseTotals.has(measurandName)) phaseTotals.set(measurandName, { unit, values: new Map() });
|
|
569
|
+
if (!phaseTotals.has(measurandName)) phaseTotals.set(measurandName, { unit, sourceAt, values: new Map() });
|
|
547
570
|
phaseTotals.get(measurandName).values.set(phaseKey, conv.val);
|
|
548
571
|
if (ctx.runtime && typeof ctx.runtime.recordPhaseMetric === 'function') {
|
|
549
572
|
ctx.runtime.recordPhaseMetric(id, evseId, connectorId, measurandName, phaseKey, conv.val, unit, receivedAt);
|
|
@@ -575,6 +598,7 @@ async function applyMeterValues(ctx, identity, evseId, connectorId, meterValueAr
|
|
|
575
598
|
};
|
|
576
599
|
}
|
|
577
600
|
if (Number.isFinite(derived.value)) {
|
|
601
|
+
if (scoped) sourceAt = data.sourceAt;
|
|
578
602
|
const { id: totalId } = await ensureMeasurement(measurand, '', derived.unit || data.unit || '');
|
|
579
603
|
if (totalId) await _writeState(ctx, totalId, derived.value, 'realtime');
|
|
580
604
|
}
|
|
@@ -589,7 +613,7 @@ async function applyMeterValues(ctx, identity, evseId, connectorId, meterValueAr
|
|
|
589
613
|
}
|
|
590
614
|
|
|
591
615
|
if (scoped && validSampleCount > 0) {
|
|
592
|
-
await ctx.runtime.publishScopedMeter(id, evseId, connectorId, values, receiveTime,
|
|
616
|
+
await ctx.runtime.publishScopedMeter(id, evseId, connectorId, values, receiveTime, Math.min(latestTsMs, receiveTime));
|
|
593
617
|
return;
|
|
594
618
|
}
|
|
595
619
|
if (validSampleCount > 0 && ctx.runtime && typeof ctx.runtime.noteMeterValue === 'function') {
|
|
@@ -64,8 +64,12 @@ class StationTelemetry {
|
|
|
64
64
|
if (previous && previous.active && txId && previous.id && txId !== previous.id && evt.type !== 'Start') return;
|
|
65
65
|
const seq = evt.seqNo == null ? undefined : Number(evt.seqNo);
|
|
66
66
|
if (previous && previous.id === txId && Number.isFinite(seq) && Number.isFinite(previous.seq) && seq <= previous.seq) return;
|
|
67
|
+
if (previous && !previous.active && txId && previous.id === txId && evt.type === 'Update') return;
|
|
67
68
|
const active = evt.type !== 'Stop';
|
|
68
|
-
|
|
69
|
+
// OCPP 2.x may omit chargingState. Only the same live transaction can
|
|
70
|
+
// retain its earlier report of charging or a pause by the vehicle.
|
|
71
|
+
const previousState = previous?.active && txId && previous.id === txId ? previous.state : '';
|
|
72
|
+
const chargingState = evt.chargingState === undefined ? previousState : String(evt.chargingState);
|
|
69
73
|
this.transactions.set(key, { id: txId, active, state: chargingState, seq });
|
|
70
74
|
if (evt.type === 'Start' && previous?.id !== txId) { this.clearFlow(key); this.samples.get(key)?.delete('socPercent'); this.samples.get('station')?.delete('socPercent'); }
|
|
71
75
|
if (evt.type === 'Stop' || chargingStateImpliesZero(chargingState)) {
|
|
@@ -119,9 +123,10 @@ class StationTelemetry {
|
|
|
119
123
|
sourceAt: Math.min(...values.map(v => v.sourceAt)), category: values.every(v => v.category === 'safeZero') ? 'safeZero' : values[0].category === 'safeZero' ? 'realtime' : values[0].category,
|
|
120
124
|
source: scopes.length === 1 ? 'single-outlet' : 'sum-of-outlets' };
|
|
121
125
|
}
|
|
126
|
+
const activeTransactions = [...this.transactions.values()].filter(transaction => transaction.active);
|
|
122
127
|
return { result, connectorCount: this.ports.size, evseCount: scopes.length, topologySource: this.inventoryMismatch ? 'inventory-mismatch' : this.declared.size ? 'commissioned' : 'observed',
|
|
123
|
-
status: preferredStatus(this.statuses.values()), active:
|
|
124
|
-
chargingState:
|
|
128
|
+
status: preferredStatus(this.statuses.values()), active: activeTransactions.length > 0,
|
|
129
|
+
chargingState: activeTransactions.length ? preferredStatus(activeTransactions.map(transaction => transaction.state)) : (this.transactions.size ? 'Idle' : ''),
|
|
125
130
|
allIdle: scopes.length > 0 && scopes.every(k => this.idle.has(k)) };
|
|
126
131
|
}
|
|
127
132
|
}
|
package/modules/ocpp/runtime.js
CHANGED
|
@@ -135,9 +135,11 @@ class NexoWattOcppAdapter extends AdapterBase {
|
|
|
135
135
|
this._freshStateCache.get(identity).set(rel, { val, ack: !!ack, category, updatedAt: Date.now() });
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
async _setStateFreshAsync(id, val, ack = true, category = 'status') {
|
|
138
|
+
async _setStateFreshAsync(id, val, ack = true, category = 'status', sourceAt) {
|
|
139
139
|
const rel = this._stripNs(id);
|
|
140
|
-
|
|
140
|
+
const state = { val, ack: !!ack };
|
|
141
|
+
if (Number.isSafeInteger(sourceAt) && sourceAt > 0) state.ts = sourceAt;
|
|
142
|
+
await this.setStateAsync(rel, state);
|
|
141
143
|
this._cacheFreshState(rel, val, ack, category);
|
|
142
144
|
}
|
|
143
145
|
|
|
@@ -415,7 +417,7 @@ class NexoWattOcppAdapter extends AdapterBase {
|
|
|
415
417
|
Math.max(30, Number(this.config.socMaxAgeSec) || 300) * 1000, this.config.zeroPowerWhenIdle !== false);
|
|
416
418
|
await this.ensureStructure(identity);
|
|
417
419
|
if (this.runtimeIndex.get(identity) !== entry || !entry.client || !entry.socketConnected) return;
|
|
418
|
-
const write = (key, val, category = 'health') => this._setStateFreshAsync(`${identity}.${key}`, val, true, category);
|
|
420
|
+
const write = (key, val, category = 'health', sourceAt) => this._setStateFreshAsync(`${identity}.${key}`, val, true, category, sourceAt);
|
|
419
421
|
// Invalidate before changing the value; consumers must never see a partial sum as fresh.
|
|
420
422
|
const power = snapshot.result.powerW;
|
|
421
423
|
const allowed = this.config.zeroPowerWhenIdle !== false;
|
|
@@ -443,8 +445,11 @@ class NexoWattOcppAdapter extends AdapterBase {
|
|
|
443
445
|
if (prior && prior.at === item.at && prior.sourceAt === item.sourceAt && prior.val === item.val && prior.category === item.category) continue;
|
|
444
446
|
if (item.category === 'safeZero' && prior?.category === 'safeZero' && prior.val === item.val) continue;
|
|
445
447
|
await this.ensureMeasurement(identity, key);
|
|
446
|
-
|
|
447
|
-
|
|
448
|
+
// ioBroker consumers read state.ts for freshness, including after a delayed
|
|
449
|
+
// publication. A measured aggregate is only as recent as its oldest input.
|
|
450
|
+
const measuredAt = item.category === 'safeZero' ? undefined : item.sourceAt;
|
|
451
|
+
await write(`measurements.${key}`, item.val, item.category || 'realtime', measuredAt);
|
|
452
|
+
if (key === 'socPercent') await write('vehicle.socPercent', item.val, 'soc', measuredAt);
|
|
448
453
|
last.set(key, item);
|
|
449
454
|
}
|
|
450
455
|
for (const [key, val] of Object.entries({
|
|
@@ -32,6 +32,33 @@ test('per-outlet transaction stop does not stop another charging transaction',()
|
|
|
32
32
|
assert.equal(t.snapshot(now,ttl,ttl).active,true);
|
|
33
33
|
t.transaction({type:'Stop',txId:'wrong',evseId:1,connectorId:1,chargingState:'Idle'});assert.equal(t.snapshot(now,ttl,ttl).active,true);
|
|
34
34
|
});
|
|
35
|
+
for (const protocol of ['ocpp2.0.1', 'ocpp2.1']) {
|
|
36
|
+
test(`${protocol}: omitted chargingState belongs only to the same active transaction`, () => {
|
|
37
|
+
for (const oldState of ['SuspendedEV', 'Charging']) {
|
|
38
|
+
const telemetry = new StationTelemetry(protocol, ['1:1']);
|
|
39
|
+
const snapshot = () => telemetry.snapshot(now, ttl, ttl);
|
|
40
|
+
const event = (type, txId, seqNo, state) => telemetry.transaction({
|
|
41
|
+
type, txId, seqNo, evseId: 1, connectorId: 1, chargingState: state,
|
|
42
|
+
});
|
|
43
|
+
event('Start', 'first', 0, oldState);
|
|
44
|
+
event('Update', 'first', 1);
|
|
45
|
+
assert.equal(snapshot().chargingState, oldState);
|
|
46
|
+
event('Stop', 'first', 2);
|
|
47
|
+
assert.equal(snapshot().active, false);
|
|
48
|
+
assert.equal(snapshot().chargingState, 'Idle');
|
|
49
|
+
event('Update', 'first', 3, 'Charging');
|
|
50
|
+
assert.equal(snapshot().active, false, 'a delayed update cannot reopen the ended session');
|
|
51
|
+
event('Start', 'second', 0);
|
|
52
|
+
assert.equal(snapshot().active, true);
|
|
53
|
+
assert.equal(snapshot().chargingState, '', 'the new session has not reported a charging state');
|
|
54
|
+
event('Stop', 'first', 3, 'SuspendedEV');
|
|
55
|
+
assert.equal(snapshot().active, true, 'late event from the old transaction is ignored');
|
|
56
|
+
event('Update', 'second', 1, 'SuspendedEV');
|
|
57
|
+
event('Update', 'second', 2);
|
|
58
|
+
assert.equal(snapshot().chargingState, 'SuspendedEV', 'a pause in the current session is retained');
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
35
62
|
test('old and repeated source timestamps do not renew samples',()=>{
|
|
36
63
|
const t=new StationTelemetry('ocpp1.6',['1:1']);t.meter(1,1,{powerW:sample(5000)},now,now);
|
|
37
64
|
t.meter(1,1,{powerW:sample(9000)},now+500,now-100);assert.equal(t.snapshot(now+500,ttl,ttl).result.powerW.val,5000);
|
|
@@ -65,3 +92,43 @@ test('real MeterValues handler normalizes kW and multiplier and rejects old samp
|
|
|
65
92
|
await applyMeterValues(ctx,'cp',1,0,[{timestamp:new Date(Date.now()-300000).toISOString(),sampledValue:[{measurand:'Power.Active.Import',value:5,unitOfMeasure:{unit:'kW'}}]}],'ocpp2.1');
|
|
66
93
|
assert.equal(received.length,1);
|
|
67
94
|
});
|
|
95
|
+
|
|
96
|
+
test('a mixed MeterValues call keeps the fresh 11 kW at its source time when later frames contain only counters', async () => {
|
|
97
|
+
const { applyMeterValues } = require('../ocpp/common');
|
|
98
|
+
const received = [];
|
|
99
|
+
const telemetry = new StationTelemetry('ocpp1.6', ['1:1']);
|
|
100
|
+
const ctx = {
|
|
101
|
+
config: { telemetryMaxAgeSec: 90 },
|
|
102
|
+
states: {
|
|
103
|
+
ensureMeasurementState: async (id, key) => `${id}.measurements.${key}`,
|
|
104
|
+
ensureTextMeasurementState: async (id, key) => `${id}.measurements.${key}`,
|
|
105
|
+
},
|
|
106
|
+
setStateFreshAsync: async () => {},
|
|
107
|
+
runtime: { publishScopedMeter: async (_id, evse, connector, values, at, sourceAt) => {
|
|
108
|
+
received.push(values);
|
|
109
|
+
telemetry.meter(evse, connector, values, at, sourceAt);
|
|
110
|
+
} },
|
|
111
|
+
};
|
|
112
|
+
const receivedAt = Date.now();
|
|
113
|
+
const time = offset => new Date(receivedAt + offset).toISOString();
|
|
114
|
+
const power = (phase, value) => ({ measurand: 'Power.Active.Import', value, phase, unit: 'W' });
|
|
115
|
+
await applyMeterValues(ctx, 'cp', 1, 1, [
|
|
116
|
+
{ timestamp: time(-1000), sampledValue: [{ value: '60000', unit: 'Wh' }] },
|
|
117
|
+
{ timestamp: time(-5000), sampledValue: [power('L1', '3600'), power('L2', '3700'), power('L3', '3700')] },
|
|
118
|
+
{ timestamp: time(-120000), sampledValue: [power(undefined, '0')] },
|
|
119
|
+
{ timestamp: time(-9000), sampledValue: [power(undefined, '4200')] },
|
|
120
|
+
{ timestamp: time(-1000), sampledValue: [
|
|
121
|
+
{ measurand: 'Power.Active.Import', value: '22', unit: 'Wh' },
|
|
122
|
+
{ measurand: 'Power.Active.Import', value: false, unit: 'W' },
|
|
123
|
+
{ measurand: 'Power.Active.Import', value: '4', multiplier: true, unit: 'W' },
|
|
124
|
+
] },
|
|
125
|
+
], 'ocpp1.6');
|
|
126
|
+
assert.equal(received.length, 1);
|
|
127
|
+
const first = telemetry.snapshot(receivedAt, ttl, ttl);
|
|
128
|
+
assert.equal(first.result.energyWh.val, 60000);
|
|
129
|
+
assert.equal(first.result.powerW?.val, 11000);
|
|
130
|
+
assert.equal(first.result.powerW.sourceAt, receivedAt - 5000);
|
|
131
|
+
assert.equal(first.result.powerW.source, 'single-outlet');
|
|
132
|
+
assert.equal(telemetry.snapshot(receivedAt + ttl - 4999, ttl, ttl).result.powerW, undefined);
|
|
133
|
+
assert.equal(telemetry.snapshot(receivedAt + ttl, ttl, ttl).result.energyWh.val, 60000);
|
|
134
|
+
});
|