fix icon mapping for asset types one-way_evse and two-way_evse, and add other names, as well - #2391
Conversation
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Documentation build overview
4 files changed± changelog.html± genindex.html± _autosummary/flexmeasures.ui.utils.view_utils.html± api/v3_0.html |
|
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 That would be a simple addition to this PR. I also think we only need to add tests for supported asset types. |
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
left a comment
There was a problem hiding this comment.
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 pointandCharge_Pointall hit the existingchargepointentry — since we don't restrict names, this handles spelling variants generally instead of one at a time - adds
wind,processandheat-storage(seeded by default, also showed?) plus the building equipment above
Campus went from 9 of 13 types showing ? to 0.
test asset that has many types


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.


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).
documentation/changelog.rstHow 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.