kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
3.05k stars 238 forks source link

Wrong icon displayed for some device_classes #703

Open ildar170975 opened 2 years ago

ildar170975 commented 2 years ago

At least for these device_class sensors a wrong icon is displayed:

Below there are more-info windows with right icons & mini-graph-card with wrong icons: image

sensor:
  - platform: template
    sensors:

      cleargrass_1_co2:
        unit_of_measurement: !secret glob__unit_of_measurement__co2
        device_class: carbon_dioxide
        ...

      cleargrass_1_pm25:
        unit_of_measurement: !secret glob__unit_of_measurement__pm25
        device_class: pm25
        ...

      cleargrass_1_tvoc:
        unit_of_measurement: !secret glob__unit_of_measurement__tvoc
        device_class: volatile_organic_compounds
        ...
ildar170975 commented 2 years ago

Here is a full list of device_classes with wrong icons (for others - icons are right):

atmospheric_pressure aqi carbon_dioxide carbon_monoxide current energy gas monetary nitrogen_dioxide nitrogen_monoxide nitrous_oxide ozone pm1 pm25 pm10 power_factor sulphur_dioxide volatile_organic_compounds voltage

Update: in fact, only a few classes have hard-coded icons in mini-graph-card, other classes will have a default “eye” icon. Since number of classes in HA is a matter of change - please take into account that the list above may become not full.

ildar170975 commented 2 years ago

Probably related to https://github.com/kalkih/mini-graph-card/issues/155

Is it required to hardcode icons for device_classes? https://github.com/kalkih/mini-graph-card/commit/853f966b2074283af65be9bc7489b08512f38b92 Isn't it possible to "import" icons from somewhere? I think that default icons for device_classes are supposed to be used (and probably "imported") everywhere - in stock cards, in custom cards.

jlsjonas commented 2 years ago

I think that default icons for device_classes are supposed to be used (and probably "imported") everywhere - in stock cards, in custom cards.

I would assume the same, sadly enough this doesn't seem to be the case.

However, there is an active community effort called custom-card-helpers that we should consider using -- will investigate for next release; as they also provided a conversion for the weird locale format (would properly resolve #702 instead of requiring a custom locale prop)