From: Jérôme Benoit Date: Sat, 21 Mar 2026 20:29:59 +0000 (+0100) Subject: refactor(ocpp2): use enum values instead of string literals in variable registry X-Git-Tag: v3.2~7 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6f0f52f6d53554508455f5edf9a51c26710bdfc1;p=e-mobility-charging-stations-simulator.git 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 --- 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,