From efbcb17e8336b5da8688594b47be5f6efefa30dc Mon Sep 17 00:00:00 2001 From: Alex McLarty Date: Tue, 9 Jan 2024 08:30:52 +0000 Subject: [PATCH 1/4] Remove unreachable code from 2.0.1 CSMS example. (#561) --- examples/v201/central_system.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/v201/central_system.py b/examples/v201/central_system.py index 0f5fb515e..54a880d89 100644 --- a/examples/v201/central_system.py +++ b/examples/v201/central_system.py @@ -42,8 +42,6 @@ async def on_connect(websocket, path): try: requested_protocols = websocket.request_headers["Sec-WebSocket-Protocol"] except KeyError: - logging.info("Client hasn't requested any Subprotocol. " "Closing Connection") - return await websocket.close() logging.error("Client hasn't requested any Subprotocol. Closing Connection") return await websocket.close() if websocket.subprotocol: From 71fee9c7f102d836f744d4d50e21adaa97f398dd Mon Sep 17 00:00:00 2001 From: Jared-Newell-Mobility <119603687+Jared-Newell-Mobility@users.noreply.github.com> Date: Tue, 9 Jan 2024 09:39:14 +0100 Subject: [PATCH 2/4] Attributes with 'v2x' are serialized as 'V2x', but should be serialized as 'V2X' (#522) --- CHANGELOG.md | 1 + ocpp/charge_point.py | 3 ++- tests/test_charge_point.py | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 013775bc6..32e052bb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Change log +- [#431](https://github.com/mobilityhouse/ocpp/issues/431) Attributes with 'v2x' are serialized as 'V2x', but should be serialized as 'V2X' - [#554](https://github.com/mobilityhouse/ocpp/issues/554) OCPP 2.0.1 Edition 2 Errata 2023-12 document added - [#548](https://github.com/mobilityhouse/ocpp/issues/548) OCPP 2.0.1 MessageInfoType attribute name correction - [#300](https://github.com/mobilityhouse/ocpp/issues/300) OCPP 2.0.1 add reference components and variables diff --git a/ocpp/charge_point.py b/ocpp/charge_point.py index c4a82d41c..997943de7 100644 --- a/ocpp/charge_point.py +++ b/ocpp/charge_point.py @@ -44,7 +44,7 @@ def camel_to_snake_case(data): def snake_to_camel_case(data): """ - Convert all keys of a all dictionaries inside given argument from + Convert all keys of all dictionaries inside given argument from snake_case to camelCase. Inspired by: https://stackoverflow.com/a/19053800/1073222 @@ -53,6 +53,7 @@ def snake_to_camel_case(data): camel_case_dict = {} for key, value in data.items(): key = key.replace("soc", "SoC") + key = key.replace("_v2x", "V2X") components = key.split("_") key = components[0] + "".join(x[:1].upper() + x[1:] for x in components[1:]) camel_case_dict[key] = snake_to_camel_case(value) diff --git a/tests/test_charge_point.py b/tests/test_charge_point.py index de505baad..e6b320ef0 100644 --- a/tests/test_charge_point.py +++ b/tests/test_charge_point.py @@ -65,6 +65,8 @@ def test_camel_to_snake_case(test_input, expected): [ ({"transaction_id": "74563478"}, {"transactionId": "74563478"}), ({"full_soc": 100}, {"fullSoC": 100}), + ({"ev_min_v2x_energy_request": 200}, {"evMinV2XEnergyRequest": 200}), + ({"v2x_charging_ctrlr": 200}, {"v2xChargingCtrlr": 200}), ], ) def test_snake_to_camel_case(test_input, expected): From 5f27521b5c7b83abfb61217036ae5776e1fb6998 Mon Sep 17 00:00:00 2001 From: Jared-Newell-Mobility <119603687+Jared-Newell-Mobility@users.noreply.github.com> Date: Tue, 9 Jan 2024 09:43:06 +0100 Subject: [PATCH 3/4] Fix type hint of OCPP 1.6 ChangeConfiguration.value (#525) --- CHANGELOG.md | 2 ++ ocpp/v16/call.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32e052bb8..e83bb5514 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Change log +- [#366](https://github.com/mobilityhouse/ocpp/issues/366) Fix type hint of OCPP 1.6 ChangeConfiguration.value - [#431](https://github.com/mobilityhouse/ocpp/issues/431) Attributes with 'v2x' are serialized as 'V2x', but should be serialized as 'V2X' - [#554](https://github.com/mobilityhouse/ocpp/issues/554) OCPP 2.0.1 Edition 2 Errata 2023-12 document added - [#548](https://github.com/mobilityhouse/ocpp/issues/548) OCPP 2.0.1 MessageInfoType attribute name correction @@ -8,6 +9,7 @@ ## 0.24.0 (2023-12-07) + - [#539](https://github.com/mobilityhouse/ocpp/issues/539) feat: Add ChargePoint._handle_call return value. Thanks [@wafa-yah](https://github.com/wafa-yah) - [#266](https://github.com/mobilityhouse/ocpp/issues/266) fix: Central System documentation link. - [#516](https://github.com/mobilityhouse/ocpp/issues/516) OCPP 2.0.1 add additional security events from v1.3. diff --git a/ocpp/v16/call.py b/ocpp/v16/call.py index 54e35c4d6..fe07e7d6d 100644 --- a/ocpp/v16/call.py +++ b/ocpp/v16/call.py @@ -1,5 +1,5 @@ from dataclasses import dataclass, field -from typing import Any, Dict, List, Optional +from typing import Dict, List, Optional from ocpp.v16.enums import ( AvailabilityType, @@ -55,7 +55,7 @@ class ChangeAvailabilityPayload: @dataclass class ChangeConfigurationPayload: key: str - value: Any + value: str @dataclass From a9df8ebdaee922c323be1d06eace2d5a35a5f747 Mon Sep 17 00:00:00 2001 From: Jared-Newell-Mobility <119603687+Jared-Newell-Mobility@users.noreply.github.com> Date: Tue, 9 Jan 2024 10:03:44 +0100 Subject: [PATCH 4/4] Bump to 0.25.0 (#558) --- CHANGELOG.md | 3 ++- docs/source/conf.py | 2 +- pyproject.toml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e83bb5514..5d263a851 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Change log +## 0.25.0 (2024-01-08) + - [#366](https://github.com/mobilityhouse/ocpp/issues/366) Fix type hint of OCPP 1.6 ChangeConfiguration.value - [#431](https://github.com/mobilityhouse/ocpp/issues/431) Attributes with 'v2x' are serialized as 'V2x', but should be serialized as 'V2X' - [#554](https://github.com/mobilityhouse/ocpp/issues/554) OCPP 2.0.1 Edition 2 Errata 2023-12 document added @@ -9,7 +11,6 @@ ## 0.24.0 (2023-12-07) - - [#539](https://github.com/mobilityhouse/ocpp/issues/539) feat: Add ChargePoint._handle_call return value. Thanks [@wafa-yah](https://github.com/wafa-yah) - [#266](https://github.com/mobilityhouse/ocpp/issues/266) fix: Central System documentation link. - [#516](https://github.com/mobilityhouse/ocpp/issues/516) OCPP 2.0.1 add additional security events from v1.3. diff --git a/docs/source/conf.py b/docs/source/conf.py index 94bd22556..592b903c2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -23,7 +23,7 @@ author = "Auke Willem Oosterhoff" # The full version, including alpha/beta/rc tags -release = "0.24.0" +release = "0.25.0" # -- General configuration --------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index b3e991d40..fa17c9d27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ocpp" -version = "0.24.0" +version = "0.25.0" description = "Python package implementing the JSON version of the Open Charge Point Protocol (OCPP)." authors = [ "André Duarte ",