Skip to content

Fix: CEM work session#188

Draft
Flix6x wants to merge 136 commits into
mainfrom
dev/fix-handshake-handler
Draft

Fix: CEM work session#188
Flix6x wants to merge 136 commits into
mainfrom
dev/fix-handshake-handler

Conversation

@Flix6x

@Flix6x Flix6x commented Feb 25, 2026

Copy link
Copy Markdown
Member

Follow-up to #187.

  • Fix handshake handler now sending back two responses against a queue that is periodically flushed (every 0.3 seconds)
  • Docker-compose stack skips running toy tutorial every time -> this is actually just for devs at the moment, because the toy account is actually needed for the CEM to run; specifically, the CEM uses the toy user credentials
  • Ported the FRBC.FillLevelTargetProfile and FRBC.UsageForecast to the FRBCSimple handler.
  • Test CEM now configures its own data dashboard in FlexMeasures
  • Test CEM now polls FlexMeasures much faster, which is more suitable for simulations.
  • A few minor fixes to the SimpleFRBC handler to get to the point that FRBCInstructions are sent back.
  • Ported the FRBC.LeakageBehaviour to the FRBCSimple handler.
  • Support wrapped S2 messages in an envelope together with metadata containing the simulation time.
  • Made the start of the schedule equal to the most recent storage status

Stijn van Houwelingen and others added 29 commits February 19, 2026 16:44
…, consolidating all dependencies into pyproject.toml and a single uv.lock file.

This simplifies and speeds up the development setup greatly.

Changes:
- Switch build backend from setuptools to hatchling
- Remove setup.cfg, tox.ini, .isort.cfg and setup.py in favour of .flake8 and pyproject.toml
- Add Poethepoet tasks
- Upgrade main Python version (CI/CD, .python-version, etc.) to 3.12
- Deprecate Python 3.9
- Add .python-version for consistent Python version management
- Create separate Dockerfile for flexmeasures-client
- Replace pip-tools with uv in all CI/CD workflows
- Remove ci/run_mypy.sh in favour of Poethepoet task
- Update documentation

Signed-off-by: Stijn van Houwelingen <teadrinkingprogrammer@github.io>
Signed-off-by: Stijn van Houwelingen <teadrinkingprogrammer@github.io>
Signed-off-by: Stijn van Houwelingen <teadrinkingprogrammer@github.io>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
…connection shuts down

Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
… is missing

Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
…) and make system_description_id optional

Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
…andlers accordingly

Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
@Flix6x Flix6x self-assigned this Feb 25, 2026
Flix6x added 13 commits April 14, 2026 10:15
…ix-handshake-handler

# Conflicts:
#	docs/CEM.rst
#	src/flexmeasures_client/s2/control_types/FRBC/frbc_simple.py
#	src/flexmeasures_client/s2/control_types/FRBC/frbc_tunes.py
#	src/flexmeasures_client/s2/script/websockets_server.py
…dler

# Conflicts:
#	docs/CEM.rst
#	src/flexmeasures_client/s2/script/websockets_server.py
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
…dler

# Conflicts:
#	src/flexmeasures_client/client.py
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 24732265334

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.005%) to 96.204%

Details

  • Coverage increased (+0.005%) from the base build.
  • Patch coverage: 3 of 3 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 685
Covered Lines: 659
Line Coverage: 96.2%
Coverage Strength: 5.77 hits per line

💛 - Coveralls

Flix6x added 16 commits May 18, 2026 15:09
…dler

# Conflicts:
#	src/flexmeasures_client/client.py
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
…dler

# Conflicts:
#	src/flexmeasures_client/client.py
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
- Update test assertions to use ._control.control_type instead of ._control_type
- Add handler_ready flag initialization for tests that register but don't await map_resource_to_asset
- Add background task cleanup after tests that create background tasks
- All CEM tests pass individually
- Move handler_ready flag setting from map_resource_to_asset into register_control_type
- This makes the code cleaner and removes redundant manual flag setting in tests
- Ensures handler_ready is set atomically with handler registration
… attribute

Context:
- _control and _handler_build_tasks were defined as class attributes
- This caused all CEM instances to share the same state
- The RM integration test showed 'FRBC not active yet' because stale state persisted between operations
Change:
- Moved _control and _handler_build_tasks initialization to __init__ as instance attributes
- Initialized before super().__init__() to ensure parent's discover() call has access to control_type property
- Each CEM instance now has its own isolated ControlContext and handler build tasks dict
This was the root cause of the integration test failures where RM would report 'FRBC not active yet'.
…_server watchdog

Context:
- _control_type was a class attribute left over from the old code
- It was set to None but never updated, causing the watchdog to never activate FRBC
- websockets_server.py was checking this stale attribute instead of the new _control.control_type
Change:
- Removed stale _control_type = None class attribute
- Updated rm_details_watchdog() to use _control.control_type instead
- This ensures the watchdog properly detects ResourceManagerDetails arrival and sends SelectControlType activation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants