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

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.

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

1 Like

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.