thomasloven / lovelace-template-entity-row

🔹 Display whatever you want in an entities card row.
MIT License
210 stars 16 forks source link

custom icon is not dispalyed sometimes #93

Open ildar170975 opened 1 year ago

ildar170975 commented 1 year ago

There is a custom "phu" icon from this package: https://github.com/elax46/custom-brand-icons

The package is installed via HACS & declared here too:

frontend:
  extra_module_url:
    - /hacsfiles/custom-brand-icons/custom-brand-icons.js

The icon is used to customize some entity and is displayed persistently in Lovelace. But it may NOT be displayed when used in template-entity-row.

Consider this code:

type: entities
entities:
  - type: custom:template-entity-row
    entity: device_tracker.xiaomi_roborock_s5

  - type: custom:template-entity-row
    entity: sun.sun
    icon: phu:roborock

  - type: custom:template-entity-row
    entity: sun.sun
    icon: '{{state_attr("device_tracker.xiaomi_roborock_s5","icon") }}'

  - type: custom:template-entity-row
    entity: sun.sun
    icon: '{{state_attr("device_tracker.ac68u_ping_device_tracker","icon") }}'

The icon is phu:roborock, the customized entity is device_tracker.xiaomi_roborock_s5. In the code above the icon is supposed to be displayed: -- Line 1: as an icon of an entity; -- Line 2: as an explicitly defined icon (icon: xxxx); -- Line 3: as an icon taken from an attribute (state_attr(xxx,'icon')). -- Line 4: here a different MDI icon is taken from an attribute of another entity (to demonstrate that using state_attr() works).

Here is how it should be displayed: image

But this custom "phu" icon is usually displayed in Editor window only - if defined using state_attr(): image

Sometimes the icon displayed on the dashboard too: image But after pressing F5 is disappeared again.

Win 10x64, Chrome (observed in iOS companion app too) 2022.11.3 latest template-entity-row (1.3.0)

ildar170975 commented 1 year ago

A similar synthetic case:

  - type: custom:template-entity-row
    entity: sun.sun
    icon: '{{ "phu:roborock" }}'

works unstable too.

ildar170975 commented 6 months ago

Same with Font Awesome icons from https://github.com/thomasloven/hass-fontawesome this works:

  - type: custom:template-entity-row
    entity: sun.sun
    icon: fas:heart

this is unstable:

  - type: custom:template-entity-row
    entity: sun.sun
    icon: '{{"fas:heart"}}'

as this is unstable too:

  - type: custom:template-entity-row
    entity: sun.sun
    icon: '{{"state_attr(.....,'icon')"}}'

if a custom icon set for this entity.