Related issue39
[e-mobility-charging-stations-simulator.git] / tests / ocpp-server / README.md
CommitLineData
fa16d389
S
1# OCPP2 Mock Server
2
dd4588bb 3This project includes an Open Charge Point Protocol (OCPP) version 2.0.1 mock server implemented in Python.
f937c172 4https://github.com/mobilityhouse/ocpp/blob/master/ocpp/v201/enums.py
fa16d389
S
5
6## Prerequisites
7
c11be92a 8This project requires Python 3.7+ and [poetry](https://python-poetry.org/) to install the required packages:
f937c172
S
9```shell
10pip install poetry
11```
12then
dd4588bb 13
ac96356c 14```shell
c11be92a 15poetry install
fa16d389
S
16```
17
f937c172 18
fa16d389
S
19## Running the Server
20
21To start the server, run the `server.py` script:
22
ac96356c 23```shell
3a89ffcb 24poetry run task server
fa16d389 25```
f937c172 26or
fa16d389 27
f937c172
S
28```shell
29poetry run task server --request GetBaseReport --period 5
30```
fa16d389
S
31The server will start listening for connections on port 9000.
32
33## Overview of the Server Scripts
34
35### Server.py
36
37The server script waits for connections from clients. When a client connects, the server creates a new instance of the `ChargePoint` class. This class includes methods for handling various OCPP actions (`BootNotification`,`GetBaseReport`), most of which return a dummy response. The `GetBaseReport` method prints the received request and returns a simple confirmation message.
38
39The server script uses the websockets and ocpp libraries to facilitate the WebSocket and OCPP communication.
40
ac96356c
JB
41## Development
42
43### Code formatting
44
45```shell
46poetry run task format
47```
48
49### Code linting
50
51```shell
52poetry run task lint
53```
54
fa16d389
S
55## Note
56
c11be92a 57Primarily, this software is intended for testing applications. The server script don't adhere to the full OCPP specifications and it is advised not to use them in a production environment without additional development.
fa16d389
S
58
59For reference:
60https://github.com/mobilityhouse/ocpp