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
First sensor ID upon a fresh db install is 2 instead of 1 #604
Labels
Comments
Suspected root causeWhen calling |
8 tasks
Suggested remedy
|
Flix6x
added a commit
that referenced
this issue
Apr 9, 2023
Signed-off-by: F.N. Claessen <felix@seita.nl>
8 tasks
Flix6x
added a commit
that referenced
this issue
Apr 12, 2023
…context of a building with PV (#534) Expand toy tutorial and chart functionality (incl. a more sensible use of the color encoding and data source attribute in charts), by: - Expanding the toy tutorial with creation of solar sensor and solar forecasts from CSV - Expanding the toy tutorial with a new schedule that takes into account solar - Allowing nesting of sensors in the `sensors_to_show` attribute, to denote that multiple sensors should be shown together, and dealing with all of its implications (axis labels, use of colors, etc.) - Visually distinguishing forecasts, schedules and measurements by source type rather than by belief horizon (incl. a simple db migration) - Adding a CLI command to create a new DataSource (so that forecasts are visually presented as originating from a forecaster) * fix charging sensor name in tutorial Signed-off-by: F.N. Claessen <felix@seita.nl> * update price sensor name in tutorial (prefer non-capitalized sensor names) Signed-off-by: F.N. Claessen <felix@seita.nl> * Print out account ID if toy account already exists Signed-off-by: F.N. Claessen <felix@seita.nl> * Fix for changed default when reading in timezone naive data: we no longer assume utc, but raise instead (see PR #521) Signed-off-by: F.N. Claessen <felix@seita.nl> * Add solar power sensor to toy account, and allow existing toy accounts to be updated by simply running `flexmeasures add toy-account` again Signed-off-by: F.N. Claessen <felix@seita.nl> * Support JSON and Callable arguments Signed-off-by: F.N. Claessen <felix@seita.nl> * get or create price sensor Signed-off-by: F.N. Claessen <felix@seita.nl> * Refactor to keep original order of sensor ids Signed-off-by: F.N. Claessen <felix@seita.nl> * Add CLI option to pass inflexible device sensors Signed-off-by: F.N. Claessen <felix@seita.nl> * Expand tutorial with scheduling against solar, which limits the available headroom for the battery Signed-off-by: F.N. Claessen <felix@seita.nl> * Add note about resampling Signed-off-by: F.N. Claessen <felix@seita.nl> * black Signed-off-by: F.N. Claessen <felix@seita.nl> * Allow nesting sensors_to_show to support layering multiple sensors in a single row within the multi-row asset chart Signed-off-by: F.N. Claessen <felix@seita.nl> * Textual changes Signed-off-by: F.N. Claessen <felix@seita.nl> * Remove print statement Signed-off-by: F.N. Claessen <felix@seita.nl> * Add missing timezone Signed-off-by: F.N. Claessen <felix@seita.nl> * Fix call to make_schedule Signed-off-by: F.N. Claessen <felix@seita.nl> * Ensure storage specs, also when make_schedule is called directly (i.e. no job) Signed-off-by: F.N. Claessen <felix@seita.nl> * Legend shows which asset a sensor belongs to, too, and sensors that share a name don't share a color (note that sensors belonging to the same asset aren't allowed to have the same name) Signed-off-by: F.N. Claessen <felix@seita.nl> * Add CLI command for adding a data source Signed-off-by: F.N. Claessen <felix@seita.nl> * DB migration for source types 'forecaster' and 'scheduler' Signed-off-by: F.N. Claessen <felix@seita.nl> * Attribute toy solar forecasts to a new DataSource of type 'forecaster' Signed-off-by: F.N. Claessen <felix@seita.nl> * Check common cases of shared sensor types Signed-off-by: F.N. Claessen <felix@seita.nl> * Add version identifier and missing parenthesis Signed-off-by: F.N. Claessen <felix@seita.nl> * black and flake8 Signed-off-by: F.N. Claessen <felix@seita.nl> * Fix test (no legend in PositionFieldDef) Signed-off-by: F.N. Claessen <felix@seita.nl> * Remove redundant detail encodings Signed-off-by: F.N. Claessen <felix@seita.nl> * Upgrade timely-beliefs for required feature from SeitaBV/timely-beliefs#122 Signed-off-by: F.N. Claessen <felix@seita.nl> * Merge db revisions Signed-off-by: F.N. Claessen <felix@seita.nl> * black Signed-off-by: F.N. Claessen <felix@seita.nl> * Speed up viz by avoiding redundant client-side transformation Signed-off-by: F.N. Claessen <felix@seita.nl> * Bump vega-lite and vegaembed Signed-off-by: F.N. Claessen <felix@seita.nl> * Ensure full-width bar width Signed-off-by: F.N. Claessen <felix@seita.nl> * black Signed-off-by: F.N. Claessen <felix@seita.nl> * Update CLI scheduling command by adding `for-storage` Signed-off-by: F.N. Claessen <felix@seita.nl> * Improve introduction to using `flexmeasures add source` Signed-off-by: F.N. Claessen <felix@seita.nl> * Introduce follow-up solar example Signed-off-by: F.N. Claessen <felix@seita.nl> * Refactor: rename "scheduling script" to "scheduler" and "forecasting script" to "forecaster" Signed-off-by: F.N. Claessen <felix@seita.nl> * Clarify event start domain setting Signed-off-by: F.N. Claessen <felix@seita.nl> * Raise instead of warn in case toy account already exists Signed-off-by: F.N. Claessen <felix@seita.nl> * Clarify loop over kwargs Signed-off-by: F.N. Claessen <felix@seita.nl> * black Signed-off-by: F.N. Claessen <felix@seita.nl> * Merge steps Signed-off-by: F.N. Claessen <felix@seita.nl> * Clarify when we choose not to show the sensor name Signed-off-by: F.N. Claessen <felix@seita.nl> * Add return type annotations Signed-off-by: F.N. Claessen <felix@seita.nl> * Add default sensors_to_show attribute to test asset Signed-off-by: F.N. Claessen <felix@seita.nl> * Add test cases for bad sensors_to_show attribute Signed-off-by: F.N. Claessen <felix@seita.nl> * Validate sensors_to_show attribute Signed-off-by: F.N. Claessen <felix@seita.nl> * Simplify code lines Signed-off-by: F.N. Claessen <felix@seita.nl> * black Signed-off-by: F.N. Claessen <felix@seita.nl> * Refactor: move util function Signed-off-by: F.N. Claessen <felix@seita.nl> * flake8 Signed-off-by: F.N. Claessen <felix@seita.nl> * Changelog entry plus upgrade instructions Signed-off-by: F.N. Claessen <felix@seita.nl> * Add documentation for nested sensors_to_show attribute Signed-off-by: F.N. Claessen <felix@seita.nl> * Resolve import error Signed-off-by: F.N. Claessen <felix@seita.nl> * redundant space Signed-off-by: F.N. Claessen <felix@seita.nl> * Resolve circular import Signed-off-by: F.N. Claessen <felix@seita.nl> * add a missing output style Signed-off-by: Nicolas Höning <nicolas@seita.nl> * Fix GH Issue #604 Signed-off-by: F.N. Claessen <felix@seita.nl> * Correct spacing of header markings Signed-off-by: F.N. Claessen <felix@seita.nl> * Add sensors_to_show attribute to tutorial printout Signed-off-by: F.N. Claessen <felix@seita.nl> * Correct sensor name in tutorial Signed-off-by: F.N. Claessen <felix@seita.nl> * Correct column name in tutorial Signed-off-by: F.N. Claessen <felix@seita.nl> * Shift sensor ids in tutorial Signed-off-by: F.N. Claessen <felix@seita.nl> * fix capitalization Signed-off-by: F.N. Claessen <felix@seita.nl> * Update uniplot output (looks like later versions have a more intuitive choice of y-axis ticks) Signed-off-by: F.N. Claessen <felix@seita.nl> * Correct data source IDs Signed-off-by: F.N. Claessen <felix@seita.nl> * test Signed-off-by: F.N. Claessen <felix@seita.nl> * Revert "test" This reverts commit b393cad. * Resolve circular import coming to light through mypy Signed-off-by: F.N. Claessen <felix@seita.nl> * Generalize util function Signed-off-by: F.N. Claessen <felix@seita.nl> * Add documentation for new CLI command Signed-off-by: F.N. Claessen <felix@seita.nl> * Add documentation for new CLI option Signed-off-by: F.N. Claessen <felix@seita.nl> --------- Signed-off-by: F.N. Claessen <felix@seita.nl> Signed-off-by: Nicolas Höning <nicolas@seita.nl> Co-authored-by: Nicolas Höning <nicolas@seita.nl>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
I expect the first sensor created to be assigned id = 1. I seemed to have encountered an inconsistency in the starting value of the auto-increment. See tech spike below for details.
Possible resolution
is_called
tof
when the auto-increment table is created (the generic asset table does not seem to have this issue, i.e. the first asset has id = 1, so that could be a hint) ORflexmeasures db-ops reset
(just afterflexmeasures db upgrade
) when setting up the database for the first time.Tech spike
Set your flexmeasures.cfg:
Create a fresh database (set password to 'toy'):
Let's check the sensor table, and specifically, its autoincrement:
Notice the last value is 1, and it has been called already, so the next call will yield the value 2. Now add the toy account:
Then check the battery sensor ID, which is the first to be created. Is it 1 or 2? 2!
Now let's test again after resetting the database:
And check the sensor table again:
Notice the last value is 1, but it hasn't been called yet. The next call will yield the value 1. Now add the toy account again:
Is the battery 1 or 2? 1!
Clean up:
The text was updated successfully, but these errors were encountered: