diff --git a/CHANGELOG.md b/CHANGELOG.md index b48892dfa..1e5559bd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ # Change log + +- [#523](https://github.com/mobilityhouse/ocpp/issues/523) The serialisation of soc to SoC should not occur in camel case if it is existing at the beginning of a field - [#515](https://github.com/mobilityhouse/ocpp/issues/515) Update Readthedocs configuration - [#602](https://github.com/mobilityhouse/ocpp/issues/602) Correct v2g serialisation/deserialisation - [#557](https://github.com/mobilityhouse/ocpp/issues/557) OCPP 2.0.1 Wrong data type in CostUpdated total_cost diff --git a/ocpp/charge_point.py b/ocpp/charge_point.py index 79f52c7b8..314feb227 100644 --- a/ocpp/charge_point.py +++ b/ocpp/charge_point.py @@ -53,6 +53,7 @@ def snake_to_camel_case(data): if isinstance(data, dict): camel_case_dict = {} for key, value in data.items(): + key = key.replace("soc_limit_reached", "SOCLimitReached") key = key.replace("soc", "SoC") key = key.replace("_v2x", "V2X").replace("_v2g", "V2G") components = key.split("_") diff --git a/tests/test_charge_point.py b/tests/test_charge_point.py index 88710e438..560961318 100644 --- a/tests/test_charge_point.py +++ b/tests/test_charge_point.py @@ -71,6 +71,7 @@ def test_camel_to_snake_case(test_input, expected): [ ({"transaction_id": "74563478"}, {"transactionId": "74563478"}), ({"full_soc": 100}, {"fullSoC": 100}), + ({"soc_limit_reached": 200}, {"SOCLimitReached": 200}), ({"ev_min_v2x_energy_request": 200}, {"evMinV2XEnergyRequest": 200}), ({"v2x_charging_ctrlr": 200}, {"v2xChargingCtrlr": 200}), ({"sign_v2g_certificate": 200}, {"signV2GCertificate": 200}),