There are two ways to run the FlexMeasures Client as a local S2 Customer Energy Manager (CEM) using WebSocket communication.
This is the easiest way to run the CEM alongside a full FlexMeasures server stack.
First, start the FlexMeasures server from the flexmeasures folder:
docker compose upThis starts:
- Web and worker servers (FlexMeasures)
- Database server (Postgres)
- Queue server (Redis)
- Mail server (MailHog)
Once the server is running, start the CEM from this (flexmeasures-client) folder:
docker compose upThe CEM runs with host networking, so it can reach the FlexMeasures server at http://localhost:5000.
TODO: fix networking.
You can now point your Resource Managers (RMs) to http://localhost:8080/ws.
If you want to run the CEM locally for development purposes, you can do the following:
First, follow the instructions in the FlexMeasures repository to set up the server.
Then, in the folder containing this repository, run:
uv sync --extra s2Then point your Resource Managers (RMs) to http://localhost:8080/ws and run:
uv run src/flexmeasures_client/s2/script/websockets_server.pyTo test, run the included example RM:
uv run src/flexmeasures_client/s2/script/websockets_client.pyThe S2 Protocol integration is still under active development. Please, beware that the logic and interfaces can change.