Conversation
Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
…ecast Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
… copilot agent instructions Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…de status Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
|
@BelhsanHmida please pick this up again. And one thought: we should check if we run the HEMS example against a FM server of at least v0.31, and otherwise raise an error message. |
…s function Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…sion requirements Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Added that check. The HEMS example now verifies the connected FlexMeasures server is at least |
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
nhoening
left a comment
There was a problem hiding this comment.
Nice!
I have three minor improvements.
Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
…setup forecasting|scheduling queue Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>
nhoening
left a comment
There was a problem hiding this comment.
Good iteration, but I got the feeling you have not tested the error handling for forecasting jobs.
Co-authored-by: Nicolas Höning <nicolas@seita.nl> Signed-off-by: Mohamed Belhsan Hmida <149331360+BelhsanHmida@users.noreply.github.com>
Co-authored-by: Nicolas Höning <nicolas@seita.nl> Signed-off-by: Mohamed Belhsan Hmida <149331360+BelhsanHmida@users.noreply.github.com>
Co-authored-by: Nicolas Höning <nicolas@seita.nl> Signed-off-by: Mohamed Belhsan Hmida <149331360+BelhsanHmida@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the HEMS tutorial workflow to use the FlexMeasures forecasting API endpoint (/sensors/{id}/forecasts/trigger) instead of relying on the FlexMeasures CLI, and adds supporting client logic/tests to improve version gating and error surfacing.
Changes:
- Add
ensure_minimum_server_versionhelper to the client and use it in the HEMS setup script. - Update HEMS forecasting example to trigger forecasts via the API and poll until completion.
- Improve API error surfacing for responses containing a
message, with accompanying tests.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/flexmeasures_client/client.py |
Adds ensure_minimum_server_version and refactors request-version checking to reuse it. |
src/flexmeasures_client/response_handling.py |
Surfaces API message fields as ValueErrors for non-2xx responses. |
examples/HEMS/forecasting.py |
Replaces CLI-based forecasting with trigger_forecast + get_forecast polling. |
examples/HEMS/HEMS_setup.py |
Enforces minimum server version required by the HEMS example. |
docs/HEMS.rst |
Updates tutorial documentation to reflect API-based forecasting and worker queue setup. |
tests/client/test_init.py |
Adds tests for ensure_minimum_server_version. |
tests/client/test_forecast.py |
Adds coverage for forecast job failure responses including API message. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Mohamed Belhsan Hmida <149331360+BelhsanHmida@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Mohamed Belhsan Hmida <149331360+BelhsanHmida@users.noreply.github.com>
Signed-off-by: Nicolas Höning <iam@nicolashoening.de>


Description
This PR updates the HEMS script to trigger forecasts using the forecasting endpoint
/sensors/{id}/forecasts/triggerinstead of running forecasts through the CLI.How to test
/sensors/{id}/forecasts/triggerendpoint.The forecasts and final HEMS outputs should match the results produced when using the CLI-based workflow.
closes #160