From 58ecc74f1501f4774c58ff633f9fc49dfd6f4d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20H=C3=B6ning?= Date: Wed, 26 Jan 2022 20:29:41 +0100 Subject: [PATCH 01/12] move dev-add commands into main add group; remove add asset command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Höning --- flexmeasures/cli/data_add.py | 88 ++---------------------------------- 1 file changed, 4 insertions(+), 84 deletions(-) diff --git a/flexmeasures/cli/data_add.py b/flexmeasures/cli/data_add.py index f072de7b1..ceb9af3fb 100755 --- a/flexmeasures/cli/data_add.py +++ b/flexmeasures/cli/data_add.py @@ -23,10 +23,7 @@ GenericAssetSchema, GenericAssetTypeSchema, ) -from flexmeasures.data.models.assets import Asset -from flexmeasures.data.schemas.assets import AssetSchema from flexmeasures.data.models.generic_assets import GenericAsset, GenericAssetType -from flexmeasures.data.models.markets import Market from flexmeasures.data.models.weather import WeatherSensor from flexmeasures.data.schemas.weather import WeatherSensorSchema from flexmeasures.data.models.data_sources import ( @@ -41,11 +38,6 @@ def fm_add_data(): """FlexMeasures: Add data.""" -@click.group("dev-add") -def fm_dev_add_data(): - """Developer CLI commands not yet meant for users: Add data.""" - - @fm_add_data.command("account-role") @with_appcontext @click.option("--name", required=True) @@ -149,7 +141,7 @@ def new_user( print(f"Successfully created user {created_user}") -@fm_dev_add_data.command("sensor") +@fm_add_data.command("sensor") @with_appcontext @click.option("--name", required=True) @click.option("--unit", required=True, help="e.g. °C, m/s, kW/m²") @@ -203,7 +195,7 @@ def add_sensor(**args): print(f"You can access it at its entity address {sensor.entity_address}") -@fm_dev_add_data.command("generic-asset-type") +@fm_add_data.command("generic-asset-type") @with_appcontext @click.option("--name", required=True) @click.option( @@ -221,7 +213,7 @@ def add_generic_asset_type(**args): print("You can now assign generic assets to it") -@fm_dev_add_data.command("generic-asset") +@fm_add_data.command("generic-asset") @with_appcontext @click.option("--name", required=True) @click.option( @@ -251,77 +243,6 @@ def add_generic_asset(**args): print("You can now assign sensors to it") -@fm_add_data.command("asset") -@with_appcontext -@click.option("--name", required=True) -@click.option("--asset-type-name", required=True) -@click.option( - "--unit", - help="unit of rate, just MW (default) for now", - type=click.Choice(["MW"]), - default="MW", -) # TODO: enable others -@click.option( - "--capacity-in-MW", - required=True, - type=float, - help="Maximum rate of this asset in MW", -) -@click.option( - "--event-resolution", - required=True, - type=int, - help="Expected resolution of the data in minutes", -) -@click.option( - "--latitude", - required=True, - type=float, - help="Latitude of the asset's location", -) -@click.option( - "--longitude", - required=True, - type=float, - help="Longitude of the asset's location", -) -@click.option( - "--owner-id", required=True, type=int, help="Id of the user who owns this asset." -) -@click.option( - "--market-id", - type=int, - help="Id of the market used to price this asset. Defaults to a dummy TOU market.", -) -@click.option( - "--timezone", - default="UTC", - help="timezone as string, e.g. 'UTC' (default) or 'Europe/Amsterdam'.", -) -def new_asset(**args): - """ - Create a new asset. - This is legacy, with the new data model we only want to add GenericAssets. - """ - check_timezone(args["timezone"]) - # if no market given, select dummy market - if args["market_id"] is None: - dummy_market = Market.query.filter(Market.name == "dummy-tou").one_or_none() - if not dummy_market: - print( - "No market ID given and also no dummy TOU market available. Maybe add structure first." - ) - raise click.Abort() - args["market_id"] = dummy_market.id - check_errors(AssetSchema().validate(args)) - args["event_resolution"] = timedelta(minutes=args["event_resolution"]) - asset = Asset(**args) - db.session.add(asset) - db.session.commit() - print(f"Successfully created asset with ID {asset.id}") - print(f"You can access it at its entity address {asset.entity_address}") - - @fm_add_data.command("weather-sensor") @with_appcontext @click.option("--name", required=True) @@ -375,7 +296,7 @@ def add_initial_structure(): populate_structure(db) -@fm_dev_add_data.command("beliefs") +@fm_add_data.command("beliefs") @with_appcontext @click.argument("file", type=click.Path(exists=True)) @click.option( @@ -711,7 +632,6 @@ def collect_weather_data(region, location, num_cells, method, store_in_db): app.cli.add_command(fm_add_data) -app.cli.add_command(fm_dev_add_data) def check_timezone(timezone): From 2fb9eabbe14112409ceb659b7c45b62fa6e88daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20H=C3=B6ning?= Date: Wed, 26 Jan 2022 21:27:57 +0100 Subject: [PATCH 02/12] Update getting-started tutorial to use our new data model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Höning --- documentation/getting-started.rst | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/documentation/getting-started.rst b/documentation/getting-started.rst index 1a9c39109..5aaa9b24a 100644 --- a/documentation/getting-started.rst +++ b/documentation/getting-started.rst @@ -151,16 +151,27 @@ Use the ``flexmeasures`` :ref:`cli`: .. code-block:: - flexmeasures add asset --name "my basement battery pack" --asset-type-name battery --capacity-in-MW 30 --event-resolution 2 --latitude 65 --longitude 123.76 --owner-id 1 + flexmeasures add generic-asset --name "my basement battery pack" --generic-asset-type-id 3 --latitude 65 --longitude 123.76 --account-id 2 -Here, I left out the ``--market-id`` parameter, because in this quickstart scenario I'm fine with the dummy market created with ``flexmeasures add structure`` above. -For the ownership, I got my user ID from the output of ``flexmeasures add user`` above, or I can browse to `FlexMeasures' user listing `_ and hover over my username. +For the ownership, I got my account ID from the output of ``flexmeasures add account`` above, or I can browse to `FlexMeasures' user listing `_ and hover over my username. -Or, you could head over to ``http://localhost:5000/assets`` (after you started FlexMeasures, see next step) and add a new asset there in a web form. +Or, you could head over to ``http://localhost:5000/assets`` (after you started FlexMeasures, see step "Run FlexMeasures" further down) and add a new asset there in a web form. Finally, you can also use the `POST /api/v2_0/assets `_ endpoint in the FlexMeasures API to create an asset. +Add your first sensor +^^^^^^^^^^^^^^^^^^^^^^^^ + +Usually, we are here because we want to measure something with respect to our assets. Each assets can have sensors for that, so let's add a power sensor for our new battery asset, using the ``flexmeasures`` :ref:`cli`: + +.. code-block:: + + flexmeasures add sensor --name power --unit MW --event-resolution 5 --timezone Europe/Amsterdam --generic-asset-id 1 --attributes '{"capacity_in_mw": 7}' + +Capacity is something unique to power sensors, so it is added as an attribute. + + Run FlexMeasures ^^^^^^^^^^^^^^^^ @@ -186,7 +197,15 @@ You can use the `POST /api/v2_0/postMeterData `_ should create a CLI function for adding a lot of data at once, from a CSV dataset. -Also, you can add forecasts for your meter data with the ``flexmeasures add`` command, here is an example: +Also, you can load in data from a file (CSV or Excel) with the ``flexmeasures`` :ref:`cli`: + +.. code-block:: + + flexmeasures add beliefs --file my-data.csv --skiprows 2 --delimiter ";" --source OurLegacyDatabase --sensor-id 1 + +This assumes you have a file `my-data.csv` with measurements, which was exported from some legacy database, and that the data is about our sensor with ID 1. This command has many options, so do use its ``--help`` function. + +Finally, you can tell FlexMeasures to create forecasts for your meter data with the ``flexmeasures add`` command, here is an example: .. code-block:: From 71c2063afe1aa249d4bc783017c73cc60419a7d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20H=C3=B6ning?= Date: Thu, 27 Jan 2022 10:32:13 +0100 Subject: [PATCH 03/12] add CLI changelog entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Höning --- documentation/cli/change_log.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/documentation/cli/change_log.rst b/documentation/cli/change_log.rst index 1f695d5ba..bcbbb0597 100644 --- a/documentation/cli/change_log.rst +++ b/documentation/cli/change_log.rst @@ -5,6 +5,13 @@ FlexMeasures CLI Changelog ********************** +since v0.9.0 | January 26, 2022 +===================== + +* add ``flexmeasures add sensor``, ''flexmeasures add generic-asset-type``, ``flexmeasures add generic-asset`` and ``flexmeasures add beliefs``. These were previously experimental features (under the `dev-add` command group). +* delete ``flexmeasures add asset``. Use ``flexmeasures add generic-asset`` instead. + + since v0.6.0 | April 2, 2021 ===================== From ee53543163996f3c33de450a79395a2fcc2b21fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20H=C3=B6ning?= Date: Thu, 27 Jan 2022 11:24:55 +0100 Subject: [PATCH 04/12] do not communicate the 'generic-' part to the user; add commands from #338 work to getting-stated guide; add commands to CLI reference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Höning --- documentation/cli/change_log.rst | 4 ++-- documentation/cli/commands.rst | 4 +++- documentation/getting-started.rst | 34 +++++++++++++++++++++---------- flexmeasures/cli/data_add.py | 28 +++++++++++++------------ 4 files changed, 43 insertions(+), 27 deletions(-) diff --git a/documentation/cli/change_log.rst b/documentation/cli/change_log.rst index bcbbb0597..f127e6e47 100644 --- a/documentation/cli/change_log.rst +++ b/documentation/cli/change_log.rst @@ -8,8 +8,8 @@ FlexMeasures CLI Changelog since v0.9.0 | January 26, 2022 ===================== -* add ``flexmeasures add sensor``, ''flexmeasures add generic-asset-type``, ``flexmeasures add generic-asset`` and ``flexmeasures add beliefs``. These were previously experimental features (under the `dev-add` command group). -* delete ``flexmeasures add asset``. Use ``flexmeasures add generic-asset`` instead. +* add ``flexmeasures add sensor``, ''flexmeasures add asset-type``, ```flexmeasures add beliefs``. These were previously experimental features (under the `dev-add` command group). +* ``flexmeasures add asset`` now directly creates an asset in the new data model. since v0.6.0 | April 2, 2021 diff --git a/documentation/cli/commands.rst b/documentation/cli/commands.rst index 8c19e18d8..e9b2f19f3 100644 --- a/documentation/cli/commands.rst +++ b/documentation/cli/commands.rst @@ -28,9 +28,11 @@ of which some are referred to in this documentation. ``flexmeasures add account-role`` Create a FlexMeasures tenant account role. ``flexmeasures add account`` Create a FlexMeasures tenant account. ``flexmeasures add user`` Create a FlexMeasures user. -``flexmeasures add asset`` Create a new asset. +``flexmeasures add asset`` Create a new asset type. +``flexmeasures add asset-type`` Create a new asset. ``flexmeasures add weather-sensor`` Add a weather sensor. ``flexmeasures add external-weather-forecasts`` Collect weather forecasts from the DarkSky API. +``flexmeasures add beliefs`` Load beliefs from file. ``flexmeasures add forecasts`` Create forecasts. ================================================= ======================================= diff --git a/documentation/getting-started.rst b/documentation/getting-started.rst index 5aaa9b24a..c9deae7cf 100644 --- a/documentation/getting-started.rst +++ b/documentation/getting-started.rst @@ -147,15 +147,17 @@ Add your first asset There are three ways to add assets: -Use the ``flexmeasures`` :ref:`cli`: +First, you can use the ``flexmeasures`` :ref:`cli`: .. code-block:: - flexmeasures add generic-asset --name "my basement battery pack" --generic-asset-type-id 3 --latitude 65 --longitude 123.76 --account-id 2 + flexmeasures add asset --name "my basement battery pack" --asset-type-id 3 --latitude 65 --longitude 123.76 --account-id 2 -For the ownership, I got my account ID from the output of ``flexmeasures add account`` above, or I can browse to `FlexMeasures' user listing `_ and hover over my username. +For the account ID, I consult ``flexmeasures show asset-types``. -Or, you could head over to ``http://localhost:5000/assets`` (after you started FlexMeasures, see step "Run FlexMeasures" further down) and add a new asset there in a web form. +For the account ID, I looked at the output of ``flexmeasures add account`` (the command we issued above) ― I could also have consulted ``flexmeasures show accounts``. + +The second way to add an asset is the UI ― head over to ``https://localhost:5000/assets`` (after you started FlexMeasures, see step "Run FlexMeasures" further down) and add a new asset there in a web form. Finally, you can also use the `POST /api/v2_0/assets `_ endpoint in the FlexMeasures API to create an asset. @@ -167,9 +169,11 @@ Usually, we are here because we want to measure something with respect to our as .. code-block:: - flexmeasures add sensor --name power --unit MW --event-resolution 5 --timezone Europe/Amsterdam --generic-asset-id 1 --attributes '{"capacity_in_mw": 7}' + flexmeasures add sensor --name power --unit MW --event-resolution 5 --timezone Europe/Amsterdam --asset-id 1 --attributes '{"capacity_in_mw": 7}' + +The asset ID I got from the last CLI command, or I could consult ``flexmeasures show account --account-id ``. -Capacity is something unique to power sensors, so it is added as an attribute. +.. note: The event resolution is given in minutes. Capacity is something unique to power sensors, so it is added as an attribute. Run FlexMeasures @@ -193,11 +197,9 @@ When you see the dashboard, the map will not work. For that, you'll need to get Add data ^^^^^^^^ -You can use the `POST /api/v2_0/postMeterData `_ endpoint in the FlexMeasures API to send meter data. +There are three ways to add data: -.. note:: `issue 56 `_ should create a CLI function for adding a lot of data at once, from a CSV dataset. - -Also, you can load in data from a file (CSV or Excel) with the ``flexmeasures`` :ref:`cli`: +First, you can load in data from a file (CSV or Excel) via the ``flexmeasures`` :ref:`cli`: .. code-block:: @@ -205,7 +207,9 @@ Also, you can load in data from a file (CSV or Excel) with the ``flexmeasures`` This assumes you have a file `my-data.csv` with measurements, which was exported from some legacy database, and that the data is about our sensor with ID 1. This command has many options, so do use its ``--help`` function. -Finally, you can tell FlexMeasures to create forecasts for your meter data with the ``flexmeasures add`` command, here is an example: +Second, you can use the `POST /api/v2_0/postMeterData `_ endpoint in the FlexMeasures API to send meter data. + +Finally, you can tell FlexMeasures to create forecasts for your meter data with the ``flexmeasures add forecasts`` command, here is an example: .. code-block:: @@ -245,3 +249,11 @@ Install and configure Redis ^^^^^^^^^^^^^^^^^^^^^^^ To let FlexMeasures queue forecasting and scheduling jobs, install a `Redis `_ server (or rent one) and configure access to it within FlexMeasures' config file (see above). You can find the necessary settings in :ref:`redis-config`. + + +Where to go from here? +------------------------ + +If your data structure is good, you should think about (continually) adding measurement data. This tutorial mentioned how to add data, but :ref:`_tut_posting_data` goes deeper with examples and terms & definitions. + +Then, you probably want to use FlexMeasures to generate forecasts and schedules! For this, read further in :ref:`_tut_forecasting_scheduling`. \ No newline at end of file diff --git a/flexmeasures/cli/data_add.py b/flexmeasures/cli/data_add.py index ceb9af3fb..fc0dd4fc1 100755 --- a/flexmeasures/cli/data_add.py +++ b/flexmeasures/cli/data_add.py @@ -157,7 +157,8 @@ def new_user( help="timezone as string, e.g. 'UTC' or 'Europe/Amsterdam'", ) @click.option( - "--generic-asset-id", + "--asset-id", + "generic_asset_id", required=True, type=int, help="Generic asset to assign this sensor to", @@ -195,7 +196,7 @@ def add_sensor(**args): print(f"You can access it at its entity address {sensor.entity_address}") -@fm_add_data.command("generic-asset-type") +@fm_add_data.command("asset-type") @with_appcontext @click.option("--name", required=True) @click.option( @@ -203,17 +204,17 @@ def add_sensor(**args): type=str, help="Description (useful to explain acronyms, for example).", ) -def add_generic_asset_type(**args): - """Add a generic asset type.""" +def add_asset_type(**args): + """Add an asset type.""" check_errors(GenericAssetTypeSchema().validate(args)) generic_asset_type = GenericAssetType(**args) db.session.add(generic_asset_type) db.session.commit() - print(f"Successfully created generic asset type with ID {generic_asset_type.id}") - print("You can now assign generic assets to it") + print(f"Successfully created asset type with ID {generic_asset_type.id}.") + print("You can now assign assets to it.") -@fm_add_data.command("generic-asset") +@fm_add_data.command("asset") @with_appcontext @click.option("--name", required=True) @click.option( @@ -228,19 +229,20 @@ def add_generic_asset_type(**args): ) @click.option("--account-id", type=int, required=True) @click.option( - "--generic-asset-type-id", + "--asset-type-id", + "generic_asset_type_id", required=True, type=int, - help="Generic asset type to assign to this asset", + help="Asset type to assign to this asset", ) -def add_generic_asset(**args): - """Add a generic asset.""" +def add_asset(**args): + """Add an asset.""" check_errors(GenericAssetSchema().validate(args)) generic_asset = GenericAsset(**args) db.session.add(generic_asset) db.session.commit() - print(f"Successfully created generic asset with ID {generic_asset.id}") - print("You can now assign sensors to it") + print(f"Successfully created asset with ID {generic_asset.id}.") + print("You can now assign sensors to it.") @fm_add_data.command("weather-sensor") From fb973760750f18e2f58a99572a351d138db5c99c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20H=C3=B6ning?= Date: Thu, 27 Jan 2022 11:34:12 +0100 Subject: [PATCH 05/12] add missing CLI documentation from PR#328 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Höning --- documentation/cli/change_log.rst | 4 ++++ documentation/cli/commands.rst | 3 +++ 2 files changed, 7 insertions(+) diff --git a/documentation/cli/change_log.rst b/documentation/cli/change_log.rst index f127e6e47..2be7c341e 100644 --- a/documentation/cli/change_log.rst +++ b/documentation/cli/change_log.rst @@ -8,8 +8,12 @@ FlexMeasures CLI Changelog since v0.9.0 | January 26, 2022 ===================== +<<<<<<< Updated upstream * add ``flexmeasures add sensor``, ''flexmeasures add asset-type``, ```flexmeasures add beliefs``. These were previously experimental features (under the `dev-add` command group). * ``flexmeasures add asset`` now directly creates an asset in the new data model. +======= +* add ``flexmeasures delete sensor``, ``flexmeasures delete nan_beliefs`` and ``flexmeasures delete unchanged_beliefs``. +>>>>>>> Stashed changes since v0.6.0 | April 2, 2021 diff --git a/documentation/cli/commands.rst b/documentation/cli/commands.rst index e9b2f19f3..f4d9b5dd7 100644 --- a/documentation/cli/commands.rst +++ b/documentation/cli/commands.rst @@ -46,8 +46,11 @@ of which some are referred to in this documentation. ``flexmeasures delete account-role`` Delete a tenant account role. ``flexmeasures delete account`` Delete a tenant account & also their users (with assets and power measurements). ``flexmeasures delete user`` Delete a user & also their assets and power measurements. +``flexmeasures delete sensor`` Delete a sensor and all beliefs about it. ``flexmeasures delete measurements`` Delete measurements (with horizon <= 0). ``flexmeasures delete prognoses`` Delete forecasts and schedules (forecasts > 0). +``flexmeasures delete unchanged_beliefs`` Delete unchanged beliefs +``flexmeasures delete nan_beliefs`` Delete NaN beliefs. ================================================= ======================================= From 344b7aacbbeaa75c9bcf7177914e8160dc6f4e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20H=C3=B6ning?= Date: Thu, 27 Jan 2022 11:35:08 +0100 Subject: [PATCH 06/12] resolve local merge conflict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Höning --- documentation/cli/change_log.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/documentation/cli/change_log.rst b/documentation/cli/change_log.rst index 2be7c341e..5c4c8fdc9 100644 --- a/documentation/cli/change_log.rst +++ b/documentation/cli/change_log.rst @@ -8,12 +8,9 @@ FlexMeasures CLI Changelog since v0.9.0 | January 26, 2022 ===================== -<<<<<<< Updated upstream * add ``flexmeasures add sensor``, ''flexmeasures add asset-type``, ```flexmeasures add beliefs``. These were previously experimental features (under the `dev-add` command group). * ``flexmeasures add asset`` now directly creates an asset in the new data model. -======= * add ``flexmeasures delete sensor``, ``flexmeasures delete nan_beliefs`` and ``flexmeasures delete unchanged_beliefs``. ->>>>>>> Stashed changes since v0.6.0 | April 2, 2021 From d6b3b7a96b8f722f763dc522b9adc66cba4b04e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20H=C3=B6ning?= Date: Thu, 27 Jan 2022 11:37:06 +0100 Subject: [PATCH 07/12] udpate CLI commands list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Höning --- documentation/cli/commands.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/documentation/cli/commands.rst b/documentation/cli/commands.rst index f4d9b5dd7..86c74f3ad 100644 --- a/documentation/cli/commands.rst +++ b/documentation/cli/commands.rst @@ -28,8 +28,9 @@ of which some are referred to in this documentation. ``flexmeasures add account-role`` Create a FlexMeasures tenant account role. ``flexmeasures add account`` Create a FlexMeasures tenant account. ``flexmeasures add user`` Create a FlexMeasures user. -``flexmeasures add asset`` Create a new asset type. -``flexmeasures add asset-type`` Create a new asset. +``flexmeasures add asset-type`` Create a new asset type. +``flexmeasures add asset`` Create a new asset. +``flexmeasures add sensor`` Add a new sensor. ``flexmeasures add weather-sensor`` Add a weather sensor. ``flexmeasures add external-weather-forecasts`` Collect weather forecasts from the DarkSky API. ``flexmeasures add beliefs`` Load beliefs from file. From d698443e34b81b2433b06ca1f31ced3ac14780d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20H=C3=B6ning?= Date: Thu, 27 Jan 2022 13:25:43 +0100 Subject: [PATCH 08/12] add changelog entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Höning --- documentation/changelog.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/documentation/changelog.rst b/documentation/changelog.rst index 31f115052..b41dedfde 100644 --- a/documentation/changelog.rst +++ b/documentation/changelog.rst @@ -8,6 +8,8 @@ v0.9.0 | February XX, 2022 New features ----------- +* Add CLI-commands ``flexmeasures add sensor``, ''flexmeasures add asset-type``, ```flexmeasures add beliefs`` (which were experimental features before). [see `PR #337 `_] + Bugfixes ----------- From 40eedc6aa0a1b614f814c03515a0096384da6598 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20H=C3=B6ning?= Date: Thu, 27 Jan 2022 13:28:07 +0100 Subject: [PATCH 09/12] fix quotes in changelog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Höning --- documentation/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/changelog.rst b/documentation/changelog.rst index b41dedfde..355226528 100644 --- a/documentation/changelog.rst +++ b/documentation/changelog.rst @@ -8,7 +8,7 @@ v0.9.0 | February XX, 2022 New features ----------- -* Add CLI-commands ``flexmeasures add sensor``, ''flexmeasures add asset-type``, ```flexmeasures add beliefs`` (which were experimental features before). [see `PR #337 `_] +* Add CLI-commands ``flexmeasures add sensor``, ``flexmeasures add asset-type``, ``flexmeasures add beliefs`` (which were experimental features before). [see `PR #337 `_] Bugfixes ----------- From 2958eb4e297b147eef3b3d3a935b0e008b28cc6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20H=C3=B6ning?= Date: Fri, 28 Jan 2022 11:50:13 +0100 Subject: [PATCH 10/12] rename commands for deleting beliefs for consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Höning --- documentation/cli/change_log.rst | 2 +- documentation/cli/commands.rst | 4 ++-- flexmeasures/cli/data_delete.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/documentation/cli/change_log.rst b/documentation/cli/change_log.rst index 5c4c8fdc9..31476ac62 100644 --- a/documentation/cli/change_log.rst +++ b/documentation/cli/change_log.rst @@ -10,7 +10,7 @@ since v0.9.0 | January 26, 2022 * add ``flexmeasures add sensor``, ''flexmeasures add asset-type``, ```flexmeasures add beliefs``. These were previously experimental features (under the `dev-add` command group). * ``flexmeasures add asset`` now directly creates an asset in the new data model. -* add ``flexmeasures delete sensor``, ``flexmeasures delete nan_beliefs`` and ``flexmeasures delete unchanged_beliefs``. +* add ``flexmeasures delete sensor``, ``flexmeasures delete nan-beliefs`` and ``flexmeasures delete unchanged-beliefs``. since v0.6.0 | April 2, 2021 diff --git a/documentation/cli/commands.rst b/documentation/cli/commands.rst index 86c74f3ad..ed8a702d8 100644 --- a/documentation/cli/commands.rst +++ b/documentation/cli/commands.rst @@ -50,8 +50,8 @@ of which some are referred to in this documentation. ``flexmeasures delete sensor`` Delete a sensor and all beliefs about it. ``flexmeasures delete measurements`` Delete measurements (with horizon <= 0). ``flexmeasures delete prognoses`` Delete forecasts and schedules (forecasts > 0). -``flexmeasures delete unchanged_beliefs`` Delete unchanged beliefs -``flexmeasures delete nan_beliefs`` Delete NaN beliefs. +``flexmeasures delete unchanged-beliefs`` Delete unchanged beliefs +``flexmeasures delete nan-beliefs`` Delete NaN beliefs. ================================================= ======================================= diff --git a/flexmeasures/cli/data_delete.py b/flexmeasures/cli/data_delete.py index 1970356e0..759489007 100644 --- a/flexmeasures/cli/data_delete.py +++ b/flexmeasures/cli/data_delete.py @@ -197,7 +197,7 @@ def delete_prognoses( depopulate_prognoses(app.db, sensor_id) -@fm_delete_data.command("unchanged_beliefs") +@fm_delete_data.command("unchanged-beliefs") @with_appcontext @click.option( "--sensor-id", @@ -275,7 +275,7 @@ def delete_unchanged_beliefs( print(f"Done! {num_beliefs_after} beliefs left") -@fm_delete_data.command("nan_beliefs") +@fm_delete_data.command("nan-beliefs") @with_appcontext @click.option( "--sensor-id", From 1a36583da3b1b39a8b8cae80c1ce7ac057f3c060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20H=C3=B6ning?= Date: Fri, 28 Jan 2022 12:10:49 +0100 Subject: [PATCH 11/12] fix two small things from review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolas Höning --- documentation/getting-started.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/getting-started.rst b/documentation/getting-started.rst index c9deae7cf..7b6cce726 100644 --- a/documentation/getting-started.rst +++ b/documentation/getting-started.rst @@ -153,7 +153,7 @@ First, you can use the ``flexmeasures`` :ref:`cli`: flexmeasures add asset --name "my basement battery pack" --asset-type-id 3 --latitude 65 --longitude 123.76 --account-id 2 -For the account ID, I consult ``flexmeasures show asset-types``. +For the asset type ID, I consult ``flexmeasures show asset-types``. For the account ID, I looked at the output of ``flexmeasures add account`` (the command we issued above) ― I could also have consulted ``flexmeasures show accounts``. @@ -165,7 +165,7 @@ Finally, you can also use the `POST /api/v2_0/assets Date: Fri, 28 Jan 2022 15:23:15 +0100 Subject: [PATCH 12/12] Add missing period --- documentation/cli/commands.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/cli/commands.rst b/documentation/cli/commands.rst index ed8a702d8..1880340a9 100644 --- a/documentation/cli/commands.rst +++ b/documentation/cli/commands.rst @@ -50,7 +50,7 @@ of which some are referred to in this documentation. ``flexmeasures delete sensor`` Delete a sensor and all beliefs about it. ``flexmeasures delete measurements`` Delete measurements (with horizon <= 0). ``flexmeasures delete prognoses`` Delete forecasts and schedules (forecasts > 0). -``flexmeasures delete unchanged-beliefs`` Delete unchanged beliefs +``flexmeasures delete unchanged-beliefs`` Delete unchanged beliefs. ``flexmeasures delete nan-beliefs`` Delete NaN beliefs. ================================================= ======================================= @@ -73,4 +73,4 @@ of which some are referred to in this documentation. ``flexmeasures db-ops reset`` Reset database data and re-create tables from data model. ``flexmeasures db-ops restore`` Restore the dump file, see `db-ops dump` (run `reset` first). ``flexmeasures db-ops save`` Backup db content to files. -================================================= ======================================= \ No newline at end of file +================================================= =======================================