From dd4588bbff2b31d206367724d0aa843ecc7ef7c6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 10 Jun 2024 18:59:21 +0200 Subject: [PATCH] refactor: refine OCPP 2 mock server defaults MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- tests/ocpp-server/README.md | 3 ++- tests/ocpp-server/server.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/ocpp-server/README.md b/tests/ocpp-server/README.md index e02d8b7b..cd6d2e5d 100644 --- a/tests/ocpp-server/README.md +++ b/tests/ocpp-server/README.md @@ -1,6 +1,6 @@ # OCPP2 Mock Server -This project includes a mock Open Charge Point Protocol (OCPP) version 2.0.1 server implemented in Python. +This project includes an Open Charge Point Protocol (OCPP) version 2.0.1 mock server implemented in Python. ## Prerequisites @@ -10,6 +10,7 @@ This project requires Python 3.7+ and the following Python packages: - `ocpp` You can install these packages using pip: + ``` pip install websockets ocpp ``` diff --git a/tests/ocpp-server/server.py b/tests/ocpp-server/server.py index 87bb2e30..2bba45dd 100644 --- a/tests/ocpp-server/server.py +++ b/tests/ocpp-server/server.py @@ -75,9 +75,9 @@ async def main(): # Create the WebSocket server and specify the handler for new connections. server = await websockets.serve( on_connect, - '0.0.0.0', # Listen on all available interfaces. + '0.0.0.0', # Listen on loopback. 9000, # Port number. - subprotocols=['ocpp2.0.1'] # Specify the OCPP 2.0.1 subprotocol. + subprotocols=['ocpp2.0', 'ocpp2.0.1'] # Specify OCPP 2.0.1 subprotocols. ) logging.info("WebSocket Server Started") # Wait for the server to close (runs indefinitely). -- 2.34.1