Repository navigation
create_storage_flex_context sends prices as consumption-price/production-price, so SoC minima can be relaxed - #298
Merged
Merged
Conversation
…oduction-price
It wrote the deprecated `consumption-price-sensor` and `production-price-sensor` fields.
FlexMeasures does not fill in its default SoC breach prices while those fields are used,
and it rejects relaxation settings next to them,
so a schedule built with this helper failed as infeasible whenever its SoC minima could not be met.
The prices now go out as `consumption-price: {"sensor": <id>}` and `production-price: {"sensor": <id>}`,
which FlexMeasures supports from v0.23.0 on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: F.N. Claessen <claessen@seita.nl>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: F.N. Claessen <claessen@seita.nl>
Coverage Report for CI Build 46740059869Coverage remained the same at 96.21%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Flix6x
commented
Dec 1, 2026
Flix6x
left a comment
Member
Author
There was a problem hiding this comment.
A self-review of #298, at its head 3a03be9, checked against FlexMeasures v1.1.3.
The fix holds. Scheduling a test battery with the flex-context this helper returns:
- With a
soc-minimathe battery can't reach, the old fields made the schedule fail as infeasible. With the new fields it is scheduled, and the shortfall is priced at the default breach price. - Adding
relax-soc-constraints: truewas refused next to the old fields ("Please switch to usingconsumption-price…"); it is accepted now. relax-soc-constraints: falsestill keeps the minima hard (infeasible), as it should.- One more thing it fixes: if the asset's own flex-context has a
consumption-price, the old fields made every schedule fail ("Must pass either consumption-price or consumption-price-sensor."), even with reachable minima. With the new fields the request's price simply takes precedence.
The two changed tests fail with main's client.py and pass with this PR; the full suite passes (873), and so does CI. The new fields arrived in FlexMeasures v0.23.0, as the changelog says, and several client methods already need v0.28.0, so nobody loses support. Nothing else in the client sends the deprecated fields.
We'll add the asset flex-context case to the changelog entry, on this branch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: F.N. Claessen <claessen@seita.nl>
Member
Author
|
Follow-ups from the review:
|
Flix6x
added a commit
that referenced
this pull request
Dec 5, 2026
…hangelog entries as additions Three of the four Fixed entries fixed things this PR itself added, never released, and refresh_forecasts is new; they join Added, split into five bullets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: F.N. Claessen <claessen@seita.nl>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
create_storage_flex_contextwrote the deprecatedconsumption-price-sensorandproduction-price-sensorfields.FlexMeasures relaxes SoC constraints by default (with a default breach price), but it skips that while the deprecated fields are used,
and it rejects
relax-soc-constraintsor an explicitsoc-minima-breach-pricenext to them (checked on v1.1.2), also when these are set on the asset's own flex-context.So a schedule built with this helper kept hard SoC minima, and failed as infeasible whenever they could not be met.
The FlexMeasures Home Assistant integration used this helper, and fixed this on its side in FlexMeasures/flexmeasures-ha-integration#34 (v0.4.3).
Fix
consumption-price: {"sensor": <id>}andproduction-price: {"sensor": <id>}.The function's parameters stay the same.
Verification
client.pyreverted tomain, the updated tests fail (2 failed).🤖 Generated with Claude Code