Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
# 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
- `ocpp`
You can install these packages using pip:
+
```
pip install websockets ocpp
```
# 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).