Skip to content

Feature custom colors#2609

Open
benderl wants to merge 23 commits into
masterfrom
feature-custom-colors
Open

Feature custom colors#2609
benderl wants to merge 23 commits into
masterfrom
feature-custom-colors

Conversation

@benderl

@benderl benderl commented Jul 29, 2025

Copy link
Copy Markdown
Contributor

@LKuemmel LKuemmel force-pushed the feature-custom-colors branch 2 times, most recently from 4afd24b to 097c646 Compare July 31, 2025 07:20
@benderl benderl force-pushed the feature-custom-colors branch from 1a9494d to 44fc1ce Compare August 8, 2025 06:54
@benderl benderl added this to the 2.1.9 milestone Aug 22, 2025
@benderl benderl force-pushed the feature-custom-colors branch from 44fc1ce to 492d1df Compare September 1, 2025 05:43
@benderl benderl force-pushed the feature-custom-colors branch from 492d1df to cfb107c Compare September 11, 2025 07:48
Comment thread packages/helpermodules/measurement_logging/write_log.py
Comment thread packages/helpermodules/update_config.py Outdated
@benderl benderl force-pushed the feature-custom-colors branch from cfb107c to aaf53b9 Compare October 20, 2025 05:44
@benderl benderl force-pushed the feature-custom-colors branch from 87c04af to 7872fc6 Compare October 30, 2025 07:49
@benderl benderl force-pushed the feature-custom-colors branch from 7872fc6 to f824b4e Compare November 13, 2025 07:55
@LKuemmel LKuemmel modified the milestones: 2.1.9, 2.2.0 Jan 8, 2026
@benderl benderl added the user-management Anpassung an die Benutzerverwaltung erforderlich! label Feb 17, 2026
@benderl benderl self-assigned this Feb 17, 2026
@benderl benderl added the ui depends on changes in ui repository label Feb 17, 2026
@benderl benderl force-pushed the feature-custom-colors branch from f824b4e to f22be23 Compare March 5, 2026 07:11
@benderl benderl removed the user-management Anpassung an die Benutzerverwaltung erforderlich! label Mar 5, 2026
@benderl

benderl commented Mar 5, 2026

Copy link
Copy Markdown
Contributor Author

Angepasst an Benutzerverwaltung.

@benderl benderl force-pushed the feature-custom-colors branch 3 times, most recently from 67faa76 to 998fe03 Compare March 10, 2026 07:52
@benderl benderl force-pushed the feature-custom-colors branch 2 times, most recently from 876aeee to cb16512 Compare March 20, 2026 09:57
@benderl benderl force-pushed the feature-custom-colors branch from cb16512 to ab438b3 Compare March 26, 2026 12:06
@benderl benderl requested a review from Copilot March 26, 2026 14:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 color fields/defaults for EVs and chargepoints, plus a component color accessor.
  • Extend measurement logging to persist a colors map alongside names.
  • 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.

Comment thread packages/modules/common/component_setup.py Outdated
Comment thread packages/helpermodules/update_config.py Outdated
Comment on lines +3049 to +3051
files.sort()
with ProcessPoolExecutor() as executor:
executor.map(_add_colors_to_log, files)

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +3011 to +3016
def upgrade_datastore_117(self) -> None:
DEFAULT_COLORS = {
"CHARGEPOINT": "#007bff",
"VEHICLE": "#17a2b8",
"INVERTER": "#28a745",
"COUNTER": "#dc3545",

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread packages/control/ev/ev.py
Comment on lines +366 to +373
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.
"""

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread packages/helpermodules/update_config.py Outdated
Comment thread packages/helpermodules/update_config.py Outdated
Comment thread packages/control/chargepoint/chargepoint_data.py
@benderl benderl force-pushed the feature-custom-colors branch from b054e0f to 78e6c97 Compare April 29, 2026 09:43
@benderl benderl force-pushed the feature-custom-colors branch 3 times, most recently from d1cb569 to 0d9c488 Compare May 11, 2026 10:06
@benderl benderl force-pushed the feature-custom-colors branch from 0d9c488 to 9c6cce0 Compare May 18, 2026 10:41
benderl and others added 18 commits May 19, 2026 11:57
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>
@benderl benderl force-pushed the feature-custom-colors branch from 5935e0a to e042ba6 Compare May 19, 2026 09:58
@benderl benderl marked this pull request as ready for review May 19, 2026 10:37
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ui depends on changes in ui repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants