Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: let CLI users pass a JSON list (as a string) to set an asset or sensor attribute #762

Merged
merged 3 commits into from Jul 19, 2023

Conversation

nhoening
Copy link
Contributor

Description

We have the flexmeasures edit attribute CLI command.

It allows to edit attribute values of several types on assets and sensors: float, bool, str, int.
We are handling lists as attribute values, as well (e.g. generic_asset.sensors_to_show), and are thinking about dictionaries.

This PR is about supporting these two types in the CLI command, as well.

Look & Feel

flexmeasures edit attribute --asset-id 27 --attribute "sensors_to_show" --list '[14, 54, 55,56]'

How to test

Edit an attribute and check in the CLI or SQL if the attribute has changed:

  • flexmeasures show asset --id 27
  • select * from generic_asset where id = 27

Also pass in wrong (non parseable) values

Further Improvements

Still need to support dicts, but that could happen in the same way easily.

… sensor attribute

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@nhoening nhoening linked an issue Jul 13, 2023 that may be closed by this pull request
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@nhoening nhoening added this to the 0.15.0 milestone Jul 18, 2023
@nhoening nhoening merged commit 9ab3a24 into main Jul 19, 2023
4 checks passed
@nhoening nhoening deleted the 469-edit-attributes-with-lists-and-dicts branch July 19, 2023 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Edit attributes with lists and dicts
2 participants