Use FastAPI to control messages that can be sent and handled. An abstraction of a charger is useful to control the payload of OCPP messages.
The idea of this project is to showcase how a decoupled abstraction and the means to communicate with another entity improve control of a charge point emulator.
The main idea is that messages exchanged go through 2 gates before being sent and after being received.
- Message is received.
- Message is passed to Handler to validate payload.
- Message is passed to Abstraction for validation.
- Response data is received from Abstraction.
- Response payload is created from Handler.
- Response is sent.
- Message to be sent is requested.
- Abstraction returns data required to create message.
- Handler creates payload from Abstraction's data.
- Message is sent
- Response is received.
- Response is validated through Handler.
- Response is passed to Abstraction for validation and parsing.
- Further actions can be queued.
TODO
Makes sure that payloads are valid OCPP messages and handles that responses are also valid OCPP messages.
Install the requirements.
$ pip install -r requirements.pyRun the example backend
$ python ws-backend.pyRun the emulator
$ cd evse
$ uvicorn main.evse --reloadFirst thing that must be done before connecting to anything is configuring the charger. Attributes such as charger id and number of connectors can be setup here. But other attributes can be added, for example, capability of connectors and starting state (i.e.: Faulted, etc...).
Connect to the backend of choice.
TODO
Add more endpoints to control abstraction. For example:
- Configure current consumption, which is useful to change subsequent MeterValues
Add more routes to abstraction and handler. For example:
- Changing transaction status depending whether Authorize or StartTransaction were accepted or not.