Add unit query parameter to GET schedule endpoint for unit conversion#1993
Open
Add unit query parameter to GET schedule endpoint for unit conversion#1993
unit query parameter to GET schedule endpoint for unit conversion#1993Conversation
Documentation build overview
Show files changed (9 files in total): 📝 9 modified | ➕ 0 added | ➖ 0 deleted
|
Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add unit parameter to fetch schedule endpoint
Add Feb 27, 2026
unit query parameter to GET schedule endpoint for unit conversion
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>
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.
The GET schedule endpoint always returned values in the sensor's native unit, making it difficult for clients that operate in different (but compatible) units.
Changes
flexmeasures/api/v3_0/sensors.pyunitquery param viaUnitFieldinget_scheduleconvert_units; returnValidationError(422) if units are incompatibleunitparameterflexmeasures/api/v3_0/tests/test_sensor_schedules.pytest_get_schedule_with_unitcovering: default (sensor unit), compatible unit conversion, and incompatible unit rejectionSome schema refactoring by @Flix6x to modernize field validation.
Example
For a sensor with unit
MW, this returns values scaled by 1000 and"unit": "kW"in the response. Requesting an incompatible unit like°Creturns a 422.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.