From 6f0f52f6d53554508455f5edf9a51c26710bdfc1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 21 Mar 2026 21:29:59 +0100 Subject: [PATCH] refactor(ocpp2): use enum values instead of string literals in variable registry Replace all string literals that have corresponding TypeScript enums: - OCPP20OperationalStatusEnumType for AvailabilityState defaultValue/enumeration - OCPP20ChargingRateUnitEnumType for ChargingScheduleAllowedChargingRateUnit defaultValue, enumeration, and description --- src/charging-station/ocpp/2.0/OCPP20VariableRegistry.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/charging-station/ocpp/2.0/OCPP20VariableRegistry.ts b/src/charging-station/ocpp/2.0/OCPP20VariableRegistry.ts index dfabb2cc..c37be16a 100644 --- a/src/charging-station/ocpp/2.0/OCPP20VariableRegistry.ts +++ b/src/charging-station/ocpp/2.0/OCPP20VariableRegistry.ts @@ -6,6 +6,7 @@ import { AttributeEnumType, DataEnumType, MutabilityEnumType, + OCPP20ChargingRateUnitEnumType, OCPP20ComponentName, OCPP20DeviceInfoVariableName, OCPP20MeasurandEnumType, @@ -2152,10 +2153,9 @@ export const VARIABLE_REGISTRY: Record = { [buildRegistryKey(OCPP20ComponentName.SmartChargingCtrlr as string, 'RateUnit')]: { component: OCPP20ComponentName.SmartChargingCtrlr as string, dataType: DataEnumType.MemberList, - defaultValue: 'A,W', - description: - "A list of supported quantities for use in a ChargingSchedule. Allowed values: 'A' and 'W'", - enumeration: ['A', 'W'], + defaultValue: `${OCPP20ChargingRateUnitEnumType.A},${OCPP20ChargingRateUnitEnumType.W}`, + description: `A list of supported quantities for use in a ChargingSchedule. Allowed values: '${OCPP20ChargingRateUnitEnumType.A}' and '${OCPP20ChargingRateUnitEnumType.W}'`, + enumeration: [OCPP20ChargingRateUnitEnumType.A, OCPP20ChargingRateUnitEnumType.W], mutability: MutabilityEnumType.ReadOnly, persistence: PersistenceEnumType.Persistent, required: true, -- 2.43.0