Skip to content

fix icon mapping for asset types one-way_evse and two-way_evse, and add other names, as well - #2391

Merged
nhoening merged 6 commits into
mainfrom
fix/evse-icon-mapping
Aug 6, 2026
Merged

fix icon mapping for asset types one-way_evse and two-way_evse, and add other names, as well#2391
nhoening merged 6 commits into
mainfrom
fix/evse-icon-mapping

Conversation

@nhoening

@nhoening nhoening commented Aug 4, 2026

Copy link
Copy Markdown
Member

Description

Asset types "two-way_evse" and "one-way_evse" have no asset icon, for example I see this on the context page for the HEMS tutorial. We also know that users could use non-officially-supported asset type names, and we add support for a bunch of those (for now as preliminary fix to cover more ground, a real approach can be improved later).

  • fix icon mapping
  • Added changelog item in documentation/changelog.rst

How to test

Load the asset context page from the HEMS tutorial before / after.
Or simply create a new asset with one of these two types.

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@nhoening nhoening added the UI label Aug 4, 2026
@nhoening nhoening added this to the 1.0.0 milestone Aug 4, 2026
@nhoening nhoening self-assigned this Aug 4, 2026
@read-the-docs-community

read-the-docs-community Bot commented Aug 4, 2026

Copy link
Copy Markdown

Documentation build overview

📚 flexmeasures | 🛠️ Build #33944177 | 📁 Comparing b9b2a94 against latest (65d2a70)

  🔍 Preview build  

4 files changed
± changelog.html
± genindex.html
± _autosummary/flexmeasures.ui.utils.view_utils.html
± api/v3_0.html

@Flix6x
Flix6x removed the request for review from Muhammad-Moiz626 August 5, 2026 10:44
@nhoening
nhoening requested a review from BelhsanHmida August 5, 2026 10:44
@Flix6x
Flix6x removed their request for review August 5, 2026 10:45
@nhoening

nhoening commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

Actually, @BelhsanHmida can you check the Campus project's context page for the same problem (asset icons for some assets, mostly charging asset, not shown other than "?").

It might be that there we used some other asset type names (we don restrict atm to only use supported ones).

We could extend SVG_ICON_MAPPING with some other common names used for EV infrastructure, like we also map "pv" and "solar" there already.

That would be a simple addition to this PR. I also think we only need to add tests for supported asset types.

BelhsanHmida and others added 4 commits August 6, 2026 14:17
The structure view fell back to a question mark for any asset type
missing from SVG_ICON_MAPPING. Three of the eight asset types that
FlexMeasures seeds by default were missing (wind, process and
heat-storage), as was EV infrastructure under names other than the two
canonical EVSE ones.

Add those three, and map the EV names that projects commonly use.
Introduce a CHARGER_ICON constant, since the charger URL is now shared
by several entries, and a FALLBACK_SVG_ICON constant for the question
mark, so tests can assert against it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Asset type names are not restricted, so projects spell the same type in
their own way. The Campus project, for instance, types its chargers as
'charge-point' and 'charging-station', which found no icon even though
SVG_ICON_MAPPING already had a 'chargepoint' entry.

Look up icons by a normalized name, keeping only lower-case
alphanumeric characters, so that separator and case variants share one
entry. The dot-separated split is kept and applied first, so a plugin's
namespaced type (for example 'myplugin.battery') still matches on its
last component.

A test guards against two mapping keys normalizing to the same name,
which would silently shadow each other.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The Campus project types most of its assets as building services
equipment (hvac, ahu, dhw, heatpump, chiller, lighting and
other-loads), which had no icon and so filled its asset structure view
with question marks. These are not FlexMeasures asset types, but
projects are free to name their asset types, and these abbreviations
are the common ones in building services.

Normalization means one 'heatpump' entry also covers the 'heat-pump'
and 'heat_pump' spellings.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@BelhsanHmida BelhsanHmida 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.

Checked the Campus page you were right, it uses different names.

Campus has no one-way_evse / two-way_evse assets at all. Its chargers are typed charge-point and charging-station, so this PR wouldn't have fixed that page as it was. charge-point was especially close we already map chargepoint, and the only difference was a hyphen.

I found: it wasn't mostly charging assets. Those were 4 of 40. Most of the question marks were building equipment hvac, ahu, dhw, lighting, chiller, heatpump, other-loads.

So the PR now:

  • adds the EV names you suggested (evse, charging_station, charging_hub, ev_charger, charger)
  • matches type names ignoring case and separators, so charge-point, charge point and Charge_Point all hit the existing chargepoint entry — since we don't restrict names, this handles spelling variants generally instead of one at a time
  • adds wind, process and heat-storage (seeded by default, also showed ?) plus the building equipment above

Campus went from 9 of 13 types showing ? to 0.

Campus — before / after
Screenshot from 2026-08-06 14-21-13
Screenshot from 2026-08-06 14-21-47

test asset that has many types
Screenshot from 2026-08-06 14-21-02
Screenshot from 2026-08-06 14-14-04

Agreed on tests I only asserted the supported types (the eight from add_default_asset_types), plus the fallback and the normalization rule, rather than listing every alias.

Small note: these showed a question mark, not blank. The asset list and map markers were always fine only the structure view uses SVG_ICON_MAPPING.

@nhoening nhoening changed the title fix icon mapping for asset types one-way_evse and two-way_evse fix icon mapping for asset types one-way_evse and two-way_evse, and add other names, as well Aug 6, 2026
@nhoening
nhoening merged commit 170cdb5 into main Aug 6, 2026
12 of 13 checks passed
@nhoening
nhoening deleted the fix/evse-icon-mapping branch August 6, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants