diff --git a/ocpp/v201/call_result.py b/ocpp/v201/call_result.py index f603b1cba..0150f207f 100644 --- a/ocpp/v201/call_result.py +++ b/ocpp/v201/call_result.py @@ -334,7 +334,7 @@ class SendLocalList: @dataclass class SetChargingProfile: - status: enums.ChargingProfileStatus + status: enums.ChargingProfileStatusEnumType status_info: Optional[datatypes.StatusInfoType] = None custom_data: Optional[Dict[str, Any]] = None diff --git a/ocpp/v201/datatypes.py b/ocpp/v201/datatypes.py index 4150dc0f4..a2e650289 100644 --- a/ocpp/v201/datatypes.py +++ b/ocpp/v201/datatypes.py @@ -555,7 +555,7 @@ class UnitOfMeasureType: UnitOfMeasureType is used by: SampledValueType """ - unit: Optional[Union[enums.StandardizedUnitsOfMeasureEnumType, str]] = None + unit: Optional[Union[enums.StandardizedUnitsOfMeasureType, str]] = None multiplier: Optional[int] = None @@ -642,7 +642,7 @@ class VPNType: user: str password: str key: str - type: enums.VPNType + type: enums.VPNEnumType group: Optional[str] = None diff --git a/ocpp/v201/enums.py b/ocpp/v201/enums.py index e9a2cbb30..12e19d05f 100644 --- a/ocpp/v201/enums.py +++ b/ocpp/v201/enums.py @@ -10,26 +10,6 @@ class StrEnum(str, Enum): # pragma: no cover pass # pragma: no cover -class DeprecatedEnumWrapper: - """ - Since enums can't be subclassed in order to add a deprecation warning, - this class is included to help warn users of deprecated enums. - """ - - def __init__(self, enum_class, alias_name): - self.enum_class = enum_class - self.alias_name = alias_name - - def __getattr__(self, name): - warn( - ( - f"Enum '{self.alias_name}' is deprecated, " - + "instead use '{self.enum_class.__name__}'" - ) - ) - return getattr(self.enum_class, name) - - class Action(StrEnum): """An Action is a required part of a Call message.""" @@ -365,7 +345,7 @@ class ChargingProfilePurposeEnumType(StrEnum): tx_profile = "TxProfile" -class ChargingProfileStatus(StrEnum): +class ChargingProfileStatusEnumType(StrEnum): """ Status returned in response to SetChargingProfile.req. """ @@ -756,9 +736,6 @@ class IdTokenEnumType(StrEnum): no_authorization = "NoAuthorization" -IdTokenType = DeprecatedEnumWrapper(IdTokenEnumType, "IdTokenType") - - class InstallCertificateStatusEnumType(StrEnum): """ InstallCertificateStatusEnumType is used by @@ -1330,7 +1307,7 @@ class UploadLogStatusEnumType(StrEnum): accepted_canceled = "AcceptedCanceled" -class VPNType(StrEnum): +class VPNEnumType(StrEnum): """ Enumeration of VPN Types used in SetNetworkProfileRequest.VPNType """ @@ -1344,7 +1321,7 @@ class VPNType(StrEnum): # DataTypes -class StandardizedUnitsOfMeasureEnumType(StrEnum): +class StandardizedUnitsOfMeasureType(StrEnum): """ Allowable values of the optional "unit" field of a Value element, as used in MeterValues.req and StopTransaction.req messages. Default value of @@ -1387,12 +1364,7 @@ class StandardizedUnitsOfMeasureEnumType(StrEnum): k = "K" -UnitOfMeasureType = DeprecatedEnumWrapper( - StandardizedUnitsOfMeasureEnumType, "UnitOfMeasureType" -) - - -class StatusInfoReasonEnumType(StrEnum): +class StatusInfoReasonType(StrEnum): """ Standardized reason codes for StatusInfo defined in Appendix 5. v1.3 """ @@ -1442,7 +1414,7 @@ class StatusInfoReasonEnumType(StrEnum): write_only = "WriteOnly" -class SecurityEventEnumType(StrEnum): +class SecurityEventType(StrEnum): """ Security Events as listed in Appendices (Appendix 1. Security Events) v1.3 """ @@ -1620,7 +1592,7 @@ class StandardizedVariableName(StrEnum): impedance = "Impedance" imsi = "IMSI" interval = "Interval" - iso_15118_evse_id = "ISO15118EvseId" + iso15118_evse_id = "ISO15118EvseId" length = "Length" light = "Light" manufacturer = "Manufacturer" @@ -2212,8 +2184,8 @@ class ConnectedEVVariableName(StrEnum): charging_complete_full = "ChargingCompleteFull" # Status values - battery_over_voltage = " BatteryOvervoltage" - battery_under_voltage = " BatteryUndervoltage" + battery_overvoltage = " BatteryOvervoltage" + battery_undervoltage = " BatteryUndervoltage" charging_current_deviation = " ChargingCurrentDeviation" battery_temperature = "BatteryTemperature" voltage_deviation = "VoltageDeviation" diff --git a/tests/v201/test_v201_data_types.py b/tests/v201/test_v201_data_types.py index c801a3ab8..30cffc552 100644 --- a/tests/v201/test_v201_data_types.py +++ b/tests/v201/test_v201_data_types.py @@ -82,8 +82,8 @@ ReasonEnumType, SetMonitoringStatusEnumType, SetVariableStatusEnumType, - StandardizedUnitsOfMeasureEnumType, - VPNType, + StandardizedUnitsOfMeasureType, + VPNEnumType, ) T = TypeVar("T", bound="dataclass") @@ -708,7 +708,7 @@ def test_network_connection_profile_type(): message_timeout=30, security_profile=1, ocpp_interface=OCPPInterfaceEnumType.wired0, - vpn=VPNType.ikev2, + vpn=VPNEnumType.ikev2, ) new_ncpt = to_datatype(NetworkConnectionProfileType, ncpt) @@ -844,7 +844,7 @@ def test_sampled_value_type(): phase=PhaseEnumType.l1, location=LocationEnumType.outlet, unit_of_measure=UnitOfMeasureType( - unit=StandardizedUnitsOfMeasureEnumType.v, multiplier=0 + unit=StandardizedUnitsOfMeasureType.v, multiplier=0 ), )