Add initial version of flexmeasures-openadr3 plugin - #1
Conversation
|
Migrate to using ingestion redis queue |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
There was a problem hiding this comment.
I'd like some clarification about dependencies. I'm not sure what the uv.lock file is used for?
Maybe it is useful for running only this plugin, and it installs FlexMeasures + dependencies?
How compatible is that with running multiple plugins?
In our practical experience, we have a FlexMeasures docker image, and we might create a dedicated one with some custom plugin with some extra requirements installed. And we might install extra plugins (like this one) even at the deployment step (e.g. with ansible).
There was a problem hiding this comment.
The uv.lock file locks dependencies to a specific version to ensure a consistent environment.
Running multiple plugins should be relatively straightforward, flexmeasures has also updated to using UV for dependency management.
In the dockerfile in the repository you can see how the plugin can be installed the same way it was done before (just with a uv pip wrapper to ensure we are in a venv).
Furthermore, older plugins that just run on pip can also be installed in this manner
Signed-off-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com>
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
|
Apologies for the delay, it's been a few hectic weeks in preparation of the residential flexibility event next week. I'm going to be going over the codebase once more on the 22nd of June to process all feedback, take another look with fresh eyes at the codebase and answer any outstanding questions. I'll be in touch! |
|
A few tests seem to have broken in the meantime with the new release, I'll fix this and the pipeline sometime this week when I find a quiet moment again. Along with that, I'll look into implementing a better cronscheduler while i'm at it. |
|
Just a heads-up: We will support secret storage and token refreshing strartegies in FlexMeasures v1.0, see the merged PR and the docs here. That implementation is partly inspired by code in this PR, so maybe we can simplify this PR? we can also do that in a follow-up, of course. We could create a version which is compatible with FM v0.33, then one that works with FM v1.0. Would love to hear your thoughts. |
|
We decided that we will only support FlexMeasures >= v1.0, relying on its secrets infrastructure. (v1.0 will be officially released very soon) |
What this adds
The initial version of
flexmeasures-openadr3: a FlexMeasures plugin that acts as anOpenADR 3.1 VEN (Virtual End Node), polling a VTN (Virtual Top Node) for
demand-response events and storing them as beliefs on FlexMeasures sensors.
It is built on the open-source
openadr3-clientlibrary and requires FlexMeasures ≥ v0.33.0 and Python ≥ 3.12.
Scope
Deliberately narrow for a first release:
through a new dashboard at
/flexmeasures-openadr3/dashboard(menu entry "OpenADR 3 Configuration").
IMPORT_CAPACITY_LIMITandEXPORT_CAPACITY_LIMIT, mapped toimport-capacity-limit/export-capacity-limitsensors (kW, 15-minute resolution).Other OpenADR payload types are out of scope for now.
How it hangs together
FlexMeasures generic asset of type
OpenADR VEN. Credentials are encrypted at rest inthe asset attributes, using
OPENADR_SECRETS_ENCRYPTION_KEYif set and falling back toFlexMeasures'
SECRET_KEY.target filter, daily UTC trigger time, and sensor mapping.
ingestionqueue. The job fetches eventsfrom the VTN, keeps only the supported payload types, validates that active intervals
from different events do not overlap, and writes
TimedBeliefs under the data sourceOpenADR 3 VTN.naturally
site-consumption-capacityandsite-production-capacityon abuilding.New plugin settings
OPENADR_SECRETS_ENCRYPTION_KEYSECRET_KEYALLOW_INSECURE_HTTP_VTNTesting
containers (
tests/test_container/), seeds events, and asserts the beliefs land on theright sensors.
.github/workflows/lint-and-test.yml) runs lint, mypy and the test suite; actionsare pinned by SHA.
examples/capacity-limits-ingestion-walkthrough/contains a self-containeddocker-compose walkthrough (VTN + Keycloak + FlexMeasures) for trying it by hand.
Known follow-ups
rq.cron.CronScheduler#2 — the daily job re-enqueues itself, so the chain breaks if a worker dies mid-job;move to
rq.cron.CronScheduler.Review notes
uv.lockaccounts for ~3.8k of the ~10k added lines; the reviewable surface is roughlyflexmeasures_openadr3/(~2.2k lines) plustests/(~1.5k).