From: Jérôme Benoit Date: Mon, 10 Jun 2024 16:59:21 +0000 (+0200) Subject: refactor: refine OCPP 2 mock server defaults X-Git-Tag: v1.3.7~86 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=dd4588bbff2b31d206367724d0aa843ecc7ef7c6;p=e-mobility-charging-stations-simulator.git refactor: refine OCPP 2 mock server defaults Signed-off-by: Jérôme Benoit --- 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).