thomasloven / lovelace-template-entity-row

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

icon not set for core entity device_tracker #128

Open Mariusthvdb opened 3 days ago

Mariusthvdb commented 3 days ago

using below config for a device_tracker has a few issues:

    entities:
      - type: custom:template-entity-row
        entity: device_tracker.private_ble_device_marijn
        active: >
          {{is_state(config.entity,'home')}}
        state: >-
          {{state_translated(config.entity)}}
        secondary: >
          Verbonden: {{states('sensor.private_ble_device_marijn_connection')}}

one of them is the icon_color, or active, which is not set anymore, but there is an open issue for that.

This issue is about the icon itself not being set.

while it should be bluetooth-connect when Home

Scherm­afbeelding 2024-06-27 om 16 22 29

it uses bluetooth-off:

Scherm­afbeelding 2024-06-27 om 16 22 22

while as you can see the tracker is Home (Thuis) and connected to its adapter.

I can force it to set the correct icon by adding the icon template

        icon: >
          {{state_attr('sensor.private_ble_device_marijn_connection','icon')}}

but, that in itself is a template entity, which is a bit odd to use in this card, when the entity itself has the correct icon 'translation' set in https://github.com/home-assistant/core/blob/dev/homeassistant/components/private_ble_device/icons.json

{
  "entity": {
    "device_tracker": {
      "device_tracker": {
        "default": "mdi:bluetooth-off",
        "state": {
          "home": "mdi:bluetooth-connect"
        }
      }
    },
    "sensor": {
      "estimated_distance": {
        "default": "mdi:signal-distance-variant"
      },
      "estimated_broadcast_interval": {
        "default": "mdi:timer-sync-outline"
      }
    }
  }
}

could it be the new icon translations are not yet supported in template-entity-row, because, as the documentation states:

entity if this evaluates to an entity id, icon, name, state and image will be taken from that entity unless manually overridden.

indicate they should be fine in this particular config using an entity. Please have a look. thx.

ildar170975 commented 1 day ago

For input_boolean & binary_sensor domains - see no issues:

image

image

    type: entities
    entities:
      - input_boolean.testing_boolean
      - type: custom:template-entity-row
        entity: input_boolean.testing_boolean
      - type: section
      - binary_sensor.testing_device_class_connectivity
      - type: custom:template-entity-row
        entity: binary_sensor.testing_device_class_connectivity

Same for automation.