Display an entity's attribute?

How do I use cards to display an attribute of an entity?

I don’t see any examples: https://www.home-assistant.io/lovelace/

The only thing I can see are direct entity state values, or custom cards to do custom things. How can I display an entity’s attribute instead of it’s state value?

e.g.
An entity has an attribute ip_address and I want to show that using Entity:

  - entities:
      - entity: sensor.iot_devices_status
        name: IoT IP Address
        // ?? show sendsor.iot_devices_status[ip_address] ??
    type: entities
6 Likes

The traditional way to display an entity’s attribute is to create a Template Sensor whose template extracts the attribute’s value. In other words, the Template Sensor acts as a proxy for the attribute. You can then use a standard card (entities, glance, etc) to display the Template Sensor’s state.

Obviously this can be tedious if you have a lot of attributes to display. There are custom cards able to display attributes directly without using a Template Sensor as a proxy.

1 Like

Thanks. I thought as much, but wasn’t sure. HA should add a feature in cards to display attributes.

8 Likes

I’ve figured out how to do it. Turns out there IS a way in the normal Lovelace UI. There is an enitites: type of attribute that does exactly this, docs:

  - entities:
      - type: attribute
        entity: device_tracker.nas
        name: IPv4
        icon: 'mdi:lan'
        attribute: ip
    type: entities

These will display the ip: attribute value of the entity device_tracker.nas. This is exactly what I was looking for.

There’s also an Entity Card option as well, just a simple attribute: option.

43 Likes

It worked, for more examples:

Hello, is it way to display only one of all attributes ? Or I can show them all ?

I think this built-in option can only show one. I know there are custom lovelace addons that can do more, though. Maybe try multiple entity row or Fold Entity Row?

In the newer versions of HA the format would be like this to display an attribute in the entities card:

type: entity
entity: calendar.78b
attribute: message
name: Avfallstype

2 Likes

A helpful thread.

I’ve just gotten this to work using:

type: entities
title: ESPresence device detection
entities:
  - type: attribute
    entity: sensor.ash_watch_ultra
    attribute: distance
    name: Ash Watch Ultra
    prefix: ''
    suffix: Metres

Just posting as things have changed a bit in the interim.

2 Likes

A word to the wise…
I wasted some time because I didn’t realize that attribute names are all lower case and use underscores instead of spaces, despite the fact that they don’t look like that when you examine an entity’s attributes from the device info screen.


but

type: entities
title: Wiser Hub
entities:
  - entity: sensor.wiser_heathub_signal
    type: attribute
    name: Uptime
    attribute: uptime
  - entity: sensor.wiser_heathub_signal
    type: attribute
    name: Last reset reason
    attribute: last_reset_reason
1 Like