From 572389955eab4697aaa7ec38c464094b82b3a707 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 26 Mar 2026 21:35:50 +0100 Subject: [PATCH] fix: use OCPP version-specific parameter keys for meter value measurands MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Remap keba-ocpp2 template configuration keys from OCPP 1.6 names to OCPP 2.0 variable names (MeterValuesSampledData → TxUpdatedMeasurands, MeterValueSampleInterval → TxUpdatedInterval, AuthorizeRemoteTxRequests → AuthorizeRemoteStart). Remove OCPP 1.6-only keys with no 2.0 equivalent. Use StandardParametersKey union to resolve the correct key at runtime based on OCPP version. --- .../keba-ocpp2.station-template.json | 21 +++---------------- src/charging-station/ocpp/OCPPServiceUtils.ts | 16 +++++++------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/assets/station-templates/keba-ocpp2.station-template.json b/src/assets/station-templates/keba-ocpp2.station-template.json index 0df78ecc..afa1d6fb 100644 --- a/src/assets/station-templates/keba-ocpp2.station-template.json +++ b/src/assets/station-templates/keba-ocpp2.station-template.json @@ -17,27 +17,17 @@ "Configuration": { "configurationKey": [ { - "key": "MeterValuesSampledData", + "key": "TxUpdatedMeasurands", "readonly": false, "value": "Energy.Active.Import.Register,Power.Active.Import,Current.Import,Voltage" }, { - "key": "MeterValueSampleInterval", + "key": "TxUpdatedInterval", "readonly": false, "value": "30" }, { - "key": "SupportedFeatureProfiles", - "readonly": true, - "value": "Core,FirmwareManagement,LocalAuthListManagement,SmartCharging,RemoteTrigger,Reservation" - }, - { - "key": "LocalAuthListEnabled", - "readonly": false, - "value": "false" - }, - { - "key": "AuthorizeRemoteTxRequests", + "key": "AuthorizeRemoteStart", "readonly": false, "value": "false" }, @@ -45,11 +35,6 @@ "key": "WebSocketPingInterval", "readonly": false, "value": "60" - }, - { - "key": "ReserveConnectorZeroSupported", - "readonly": false, - "value": "false" } ] }, diff --git a/src/charging-station/ocpp/OCPPServiceUtils.ts b/src/charging-station/ocpp/OCPPServiceUtils.ts index f502a879..b0ecd94c 100644 --- a/src/charging-station/ocpp/OCPPServiceUtils.ts +++ b/src/charging-station/ocpp/OCPPServiceUtils.ts @@ -2029,17 +2029,19 @@ const getSampledValueTemplate = ( ) return } + const isOCPP2 = + chargingStation.stationInfo?.ocppVersion === OCPPVersion.VERSION_20 || + chargingStation.stationInfo?.ocppVersion === OCPPVersion.VERSION_201 + const measurandsParameterKey = isOCPP2 + ? StandardParametersKey.TxUpdatedMeasurands + : StandardParametersKey.MeterValuesSampledData if ( measurand !== MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER && - getConfigurationKey( - chargingStation, - StandardParametersKey.MeterValuesSampledData - )?.value?.includes(measurand) === false + getConfigurationKey(chargingStation, measurandsParameterKey)?.value?.includes(measurand) === + false ) { logger.debug( - `${chargingStation.logPrefix()} Trying to get MeterValues measurand '${measurand}' ${onPhaseStr}in template on connector id ${connectorId.toString()} not found in '${ - StandardParametersKey.MeterValuesSampledData - }' OCPP parameter` + `${chargingStation.logPrefix()} Trying to get MeterValues measurand '${measurand}' ${onPhaseStr}in template on connector id ${connectorId.toString()} not found in '${measurandsParameterKey}' OCPP parameter` ) return } -- 2.43.0