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

Improve from scratch tutorial for UI views #443

Merged
merged 4 commits into from Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions documentation/host/docker.rst
Expand Up @@ -57,6 +57,8 @@ Browsing ``http://localhost:5000`` should work now and ask you to log in.
Of course, you might not have created a user. You can use ``docker exec -it <flexmeasures-container-name> bash`` to go inside the container and use the :ref:`cli` to create everything you need.


.. _docker_configuration:

Configuration and customization
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
11 changes: 8 additions & 3 deletions documentation/tut/toy-example-from-scratch.rst
Expand Up @@ -65,6 +65,8 @@ Install Flexmeasures and the database
$ docker stop flexmeasures-tutorial-db
$ docker stop flexmeasures-tutorial-fm

.. note:: A tip on Linux/MacOs ― You might have the ``docker`` command, but need `sudo` rights to execute it. ``alias docker='sudo docker'`` enables you to still run this tutorial.
nhoening marked this conversation as resolved.
Show resolved Hide resolved


.. tab:: On your PC

Expand Down Expand Up @@ -158,11 +160,14 @@ Yes, that is quite a large battery :)

.. note:: Obviously, you can use the ``flexmeasures`` command to create your own, custom account and assets. See :ref:`cli`. And to create, edit or read asset data via the API, see :ref:`v3_0`.

We can also look at the battery asset in the UI of FlexMeasures (start FlexMeasures with ``flexmeasures run``, username is "toy-user@flexmeasures.io", password is "toy-password"):
We can also look at the battery asset in the UI of FlexMeasures (in Docker, the FlexMeasures web server already runs, on your PC you can start it with ``flexmeasures run``).
Visit `http://localhost:5000/assets <http://localhost:5000/assets>`_ (username is "toy-user@flexmeasures.io", password is "toy-password") and select "toy-battery":

.. image:: https://github.com/FlexMeasures/screenshots/raw/main/tut/toy-schedule/asset-view.png
:align: center

.. note:: You won't see the map tiles, as we have not configured the :ref:`MAPBOX_ACCESS_TOKEN`. If you have one, you can configure it via ``flexmeasures.cfg`` (for Docker, see :ref:`docker_configuration`).


Add some price data
---------------------------------------
Expand Down Expand Up @@ -241,7 +246,7 @@ Let's look at the price data we just loaded:



Again, we can also view these prices in the FlexMeasures UI:
Again, we can also view these prices in the `FlexMeasures UI <http://localhost:5000/sensors/3/>`_:

.. image:: https://github.com/FlexMeasures/screenshots/raw/main/tut/toy-schedule/sensor-data-prices.png
:align: center
Expand Down Expand Up @@ -297,7 +302,7 @@ Great. Let's see what we made:

Here, negative values denote output from the grid, so that's when the battery gets charged.

We can also look at the charging schedule in the FlexMeasures UI (reachable via the asset page for the battery):
We can also look at the charging schedule in the `FlexMeasures UI <http://localhost:5000/sensors/2/>`_ (reachable via the asset page for the battery):

.. image:: https://github.com/FlexMeasures/screenshots/raw/main/tut/toy-schedule/sensor-data-charging.png
:align: center
Expand Down
3 changes: 2 additions & 1 deletion flexmeasures/utils/config_utils.py
Expand Up @@ -155,9 +155,10 @@ def read_env_vars(app: Flask):
At the moment, these are:
- All required variables
- Logging settings
- access tokens
nhoening marked this conversation as resolved.
Show resolved Hide resolved
- plugins (handled in plugin utils)
"""
for var in required + ["LOGGING_LEVEL"]:
for var in required + ["LOGGING_LEVEL", "MAPBOX_ACCESS_TOKEN", "SENTRY_SDN"]:
app.config[var] = os.getenv(var, app.config.get(var, None))
# DEBUG in env can come in as a string ("True") so make sure we don't trip here
app.config["DEBUG"] = int(bool(os.getenv("DEBUG", app.config.get("DEBUG", False))))
Expand Down