Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.6 Action Enum members corrected #600

Merged
merged 11 commits into from
Feb 14, 2024
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- [#508](https://github.com/mobilityhouse/ocpp/issues/508) Exception - OccurrenceConstraintViolationError doc string correction

## DEPRECATED ##
- [#599](https://github.com/mobilityhouse/ocpp/issues/599) v1.6 Action Enum members corrected IMPORTANT SEE UPGRADE PATH [#599](https://github.com/mobilityhouse/ocpp/issues/599)
- [#579](https://github.com/mobilityhouse/ocpp/issues/579) v2.0.1 Action enums corrected - IMPORTANT SEE UPGRADE PATH [#579](https://github.com/mobilityhouse/ocpp/issues/579)

## BREAKING ##
Expand Down Expand Up @@ -55,7 +56,6 @@
- [#528](https://github.com/mobilityhouse/ocpp/issues/528) v2.0.1 CertificateHashDataChainType childCertificateHashData requires the default of None.
- [#510](https://github.com/mobilityhouse/ocpp/issues/510) v2.0.1 UnitOfMeasureType - Enums missing and update docstring to allow use for variableCharacteristics.
- [#508](https://github.com/mobilityhouse/ocpp/issues/508) Exception - OccurrenceConstraintViolationError doc string correction.

- [#511](https://github.com/mobilityhouse/ocpp/issues/511) 2.0.1 Units of Measure update to match Appendix 2. Standardized Units Of Measure

## 0.22.0 (2023-11-03)
Expand All @@ -64,9 +64,7 @@
- [#278](https://github.com/mobilityhouse/ocpp/pull/278) Fix types for attributes of OCPP 1.6's type `IdTagInfo`. Thanks [@chan-vince](https://github.com/chan-vince)
- [#504](https://github.com/mobilityhouse/ocpp/pull/504) Add missing tech_info attribute to v2.0.1 EventDataType. Thanks [@LokiHokie](https://github.com/LokiHokie)
- [#381](https://github.com/mobilityhouse/ocpp/issues/381) Add FormationError and OccurrenceConstraintViolationError.

- [#373](https://github.com/mobilityhouse/ocpp/issues/373) v201.datatypes.ChargingNeedsType.request_energy_transfer is mistyped

- [#207](https://github.com/mobilityhouse/ocpp/issues/207) v16/schemas/StopTransaction.json missing "Hertz"

## 0.21.0 (2023-10-19)
Expand Down
52 changes: 52 additions & 0 deletions ocpp/v16/enums.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from warnings import warn

try:
# breaking change introduced in python 3.11
from enum import StrEnum
Expand All @@ -11,6 +13,14 @@ class StrEnum(str, Enum): # pragma: no cover
class Action(StrEnum):
"""An Action is a required part of a Call message."""

def __init__(self, *args, **kwargs):
warn(
message="Action enum contains deprecated members and will be removed in "
"the next major release, please use snake case members.",
category=DeprecationWarning,
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include the category of warning to be a DepricationWarning?
See DeprecationWarning and https://docs.python.org/3/library/warnings.html#warnings.warn

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Satisfied with commit - 9a40554


# --------- Soon to be deprecated ---------------------
Authorize = "Authorize"
BootNotification = "BootNotification"
CancelReservation = "CancelReservation"
Expand Down Expand Up @@ -51,6 +61,48 @@ class Action(StrEnum):
UnlockConnector = "UnlockConnector"
UpdateFirmware = "UpdateFirmware"

# --------------------------------------------------------

authorize = "Authorize"
boot_notification = "BootNotification"
cancel_reservation = "CancelReservation"
certificate_signed = "CertificateSigned"
change_availability = "ChangeAvailability"
change_configuration = "ChangeConfiguration"
clear_cache = "ClearCache"
clear_charging_profile = "ClearChargingProfile"
data_transfer = "DataTransfer"
delete_certificate = "DeleteCertificate"
diagnostics_status_notification = "DiagnosticsStatusNotification"
extended_trigger_message = "ExtendedTriggerMessage"
firmware_status_notification = "FirmwareStatusNotification"
get_composite_schedule = "GetCompositeSchedule"
get_configuration = "GetConfiguration"
get_diagnostics = "GetDiagnostics"
get_installed_certificate_ids = "GetInstalledCertificateIds"
get_local_list_version = "GetLocalListVersion"
get_log = "GetLog"
heartbeat = "Heartbeat"
install_certificate = "InstallCertificate"
log_status_notification = "LogStatusNotification"
meter_values = "MeterValues"
remote_start_transaction = "RemoteStartTransaction"
remote_stop_transaction = "RemoteStopTransaction"
reserve_now = "ReserveNow"
reset = "Reset"
security_event_notification = "SecurityEventNotification"
send_local_list = "SendLocalList"
set_charging_profile = "SetChargingProfile"
sign_certificate = "SignCertificate"
signed_firmware_status_notification = "SignedFirmwareStatusNotification"
signed_update_firmware = "SignedUpdateFirmware"
start_transaction = "StartTransaction"
status_notification = "StatusNotification"
stop_transaction = "StopTransaction"
trigger_message = "TriggerMessage"
unlock_connector = "UnlockConnector"
update_firmware = "UpdateFirmware"


class AuthorizationStatus(StrEnum):
"""
Expand Down
Loading