Feature custom colors#2609
Conversation
4afd24b to
097c646
Compare
1a9494d to
44fc1ce
Compare
44fc1ce to
492d1df
Compare
492d1df to
cfb107c
Compare
cfb107c to
aaf53b9
Compare
87c04af to
7872fc6
Compare
7872fc6 to
f824b4e
Compare
f824b4e to
f22be23
Compare
|
Angepasst an Benutzerverwaltung. |
67faa76 to
998fe03
Compare
876aeee to
cb16512
Compare
cb16512 to
ab438b3
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces configurable color attributes for vehicles, chargepoints, and system components, and propagates those colors into measurement log files to support UI “custom colors” functionality (linked UI PR: openwb-ui-settings#906).
Changes:
- Add
colorfields/defaults for EVs and chargepoints, plus a component color accessor. - Extend measurement logging to persist a
colorsmap alongsidenames. - Add datastore upgrade v117 to backfill missing color topics and migrate existing log files; update MQTT ACLs to allow vehicle color topics.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/modules/common/utils/component_parser.py | Adds lookup helper to fetch a component’s color by component id. |
| packages/modules/common/component_setup.py | Introduces default colors on component setup objects (currently blocks custom component colors). |
| packages/helpermodules/update_config.py | Bumps datastore version and adds v117 migration for color topics + historical log migration. |
| packages/helpermodules/setdata.py | Validates incoming vehicle /color topics as strings. |
| packages/helpermodules/measurement_logging/write_log.py | Persists content["colors"] and adds get_colors() to compute colors per entry. |
| packages/control/ev/ev.py | Adds color field to EV data model. |
| packages/control/chargepoint/chargepoint_data.py | Adds color field to chargepoint config model. |
| data/config/mosquitto/public/default-dynamic-security.json | Extends dynamic-security ACLs for vehicle color topics (read + set). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| files.sort() | ||
| with ProcessPoolExecutor() as executor: | ||
| executor.map(_add_colors_to_log, files) |
There was a problem hiding this comment.
Using ProcessPoolExecutor here has a few operational risks: the worker function is nested (can’t be pickled under the spawn start method), and exceptions from executor.map(...) won’t be surfaced unless the returned iterator is consumed. Consider switching to ThreadPoolExecutor (I/O-bound work) or moving the worker to module scope and explicitly consuming the results (e.g., for _ in executor.map(...): pass) so failures aren’t silently ignored.
| def upgrade_datastore_117(self) -> None: | ||
| DEFAULT_COLORS = { | ||
| "CHARGEPOINT": "#007bff", | ||
| "VEHICLE": "#17a2b8", | ||
| "INVERTER": "#28a745", | ||
| "COUNTER": "#dc3545", |
There was a problem hiding this comment.
New behavior: upgrade_datastore_117 mutates topics and migrates log files, but there’s no unit test coverage for this upgrade (this repo already tests other datastore upgrades in update_config_test.py). Adding tests for the topic-migration logic (vehicle color topic creation, chargepoint/component config color injection, and handling of missing/None type) would help prevent regressions.
| def get_colors(elements: Dict) -> Dict: | ||
| """ Ermittelt die Farben der Fahrzeuge, Ladepunkte und Komponenten, welche | ||
| in elements vorhanden sind und gibt diese als Dictionary zurück. | ||
| Parameter | ||
| --------- | ||
| elements: dict | ||
| Dictionary, das die Messwerte enthält. | ||
| """ |
There was a problem hiding this comment.
get_colors() is new logic that affects the persisted measurement log format (content["colors"]). This module already has unit tests (write_log_test.py) for related helpers like get_names, but there are no tests for get_colors (including fallbacks to default color when data lookups fail). Add tests similar to test_get_names by monkeypatching get_component_color_by_id and/or data.data accessors.
b054e0f to
78e6c97
Compare
d1cb569 to
0d9c488
Compare
0d9c488 to
9c6cce0
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
catch corrupt log files on update Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Koala - Add custom colors - charge points * Koala - Add custom colors - battery * Daily totals - multiple batteries dropdown - icons: user defined colors * Add user defined colors to history chart * Add user defined colors to energy flow chart * Add user defined colors to vehicle cards * Add user defined colors to tables (vehicle & charge points) * Use vite-svg-loader for svg icons * Make CSS consistent of all components --------- Co-authored-by: Lutz Bender <github@lutz-bender.de> Co-authored-by: LKuemmel <lena.kuemmel@openwb.de> Co-authored-by: benderl <benderl@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
5935e0a to
e042ba6
Compare
* Flow chart new design * DailyTotals new design * fix battery color in flow diagram * History chart new design * Flow chart drop shadows for Safari * Flow chart CCS for Safari * Charge point cards new design * Charge point & vehicle select buttons update to new design * update icon color * Vehicle Card new design * Battery card new design * Update table background * custom color card border left * Change carousel button background color * new energy flow animation * fix custom symbol color - Daily totals * formatting * Carousel control CSS global in quasar variables file * update carousel CSS * update dropdown menu CSS * new design CSS for button groups * flow chart resize soc clip to prevent overlap * formatting * update card background - dark theme * update battery mode buttons to new design * apply new design to dark theme * Adjust CSS * update global CSS * reorder global CSS color variables * cleanup global color variables light and dark themes * remove unused colors * Global CSS consolidate CSS selectors * Scheduled /Time plan buttons / plan details info-box - new design * Centralize message/info box CSS in global file * update jsdoc for store
* Flow chart new design * DailyTotals new design * fix battery color in flow diagram * History chart new design * Flow chart drop shadows for Safari * Flow chart CCS for Safari * Charge point cards new design * Charge point & vehicle select buttons update to new design * update icon color * Vehicle Card new design * Battery card new design * Update table background * custom color card border left * Change carousel button background color * new energy flow animation * fix custom symbol color - Daily totals * formatting * Carousel control CSS global in quasar variables file * update carousel CSS * update dropdown menu CSS * new design CSS for button groups * flow chart resize soc clip to prevent overlap * formatting * update card background - dark theme * update battery mode buttons to new design * apply new design to dark theme * Adjust CSS * update global CSS * reorder global CSS color variables * cleanup global color variables light and dark themes * remove unused colors * Global CSS consolidate CSS selectors * Scheduled /Time plan buttons / plan details info-box - new design * Centralize message/info box CSS in global file * update jsdoc for store * setting build custom colors
* Flow chart new design * DailyTotals new design * fix battery color in flow diagram * History chart new design * Flow chart drop shadows for Safari * Flow chart CCS for Safari * Charge point cards new design * Charge point & vehicle select buttons update to new design * update icon color * Vehicle Card new design * Battery card new design * Update table background * custom color card border left * Change carousel button background color * new energy flow animation * fix custom symbol color - Daily totals * formatting * Carousel control CSS global in quasar variables file * update carousel CSS * update dropdown menu CSS * new design CSS for button groups * flow chart resize soc clip to prevent overlap * formatting * update card background - dark theme * update battery mode buttons to new design * apply new design to dark theme * Adjust CSS * update global CSS * reorder global CSS color variables * cleanup global color variables light and dark themes * remove unused colors * Global CSS consolidate CSS selectors * Scheduled /Time plan buttons / plan details info-box - new design * Centralize message/info box CSS in global file * update jsdoc for store * setting build custom colors * New design Koala build
UI: openWB/openwb-ui-settings#906