Skip to content

Conversation

@nhoening
Copy link
Contributor

@nhoening nhoening commented Jan 9, 2026

FlexMeasures/flexmeasures#1885 made the /assets endpoint more powerful in selecting subtrees of assets and saving bandwidth.

This PR supports that in the client.

Also, it implements that the client keeps knowledge of the server version, so it can look it up for handling such cases - if the new fields are being used against an older server version than v0.31, they will not be applied but a warning is printed.

I tested this with the HEMS example (in the server, I turned FLEXMEASURES_API_SUNSET_ACTIVE=True). I found one place where I needed to use the new fieldsparameter, and I used theroot` parameter, as well (the root asset is the building asset).

…em in a resuable way

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
…week

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Copy link
Contributor

@Flix6x Flix6x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A preliminary unprompted review. 😁

@nhoening
Copy link
Contributor Author

I am currently battling the tests, probably need to bring some mock in place correctly.

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@Flix6x
Copy link
Contributor

Flix6x commented Jan 10, 2026

I can easily fix that for you.

Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
@nhoening
Copy link
Contributor Author

I can easily fix that for you.

Thanks!!

…flexmeasures-client into feat/new-assets-api-fields
…ors() so it returns the root asset, then use that for asset lookup

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@nhoening nhoening requested a review from Flix6x January 11, 2026 15:38
@Flix6x
Copy link
Contributor

Flix6x commented Jan 11, 2026

Just noticing this PR partly duplicates changes in https://github.com/FlexMeasures/flexmeasures-client/pull/148/changes. It's good that the work done on client.py on that PR is factored out to a separate PR (i.e. this one), but, conversely, no changes to the HEMS script should probably happen in this PR. It will just lead to avoidable merge conflicts.

@nhoening
Copy link
Contributor Author

Just noticing this PR partly duplicates changes in https://github.com/FlexMeasures/flexmeasures-client/pull/148/changes. It's good that the work done on client.py on that PR is factored out to a separate PR (i.e. this one), but, conversely, no changes to the HEMS script should probably happen in this PR. It will just lead to avoidable merge conflicts.

I don't believe these changes would cause real problems, but I will reverse them if you want.

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Copy link
Contributor

@Flix6x Flix6x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be my preference, yes.

@nhoening
Copy link
Contributor Author

Oh, you mean everything under examples/HEMS, also the usage of the building asset for querying?

…and_sensors() so it returns the root asset, then use that for asset lookup"

This reverts commit ce4d618.
@nhoening
Copy link
Contributor Author

Done. There is only one change left in the HEMS folder, which I would like to keep:

assets = await client.get_assets(fields=["id", "name", "attributes"])

instead of just calling client.get_assets(). Seems easy to keep in mind, if this one line indeed causes a merge conflict.

If you don't object, I'll merge it later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants