How to use a status attribute in LoveLace card

Hi,

I searched through many posts, but could not find a solution that worked ( or maybe I’m just too unexperienced)

I have this entity
Schermafbeelding 2020-04-23 om 14.25.00

And wanted to show the Uptime in a LoveLace card.
By default it shows the state (good)
Schermafbeelding 2020-04-23 om 14.21.04

What do have to do to show other items like the uptime?

thanks in advance

Two options,

  1. This custom card that displays attributes as a list:
  1. Or creating a sensor from the attribute, that you can use in any card:
1 Like

Thanks…

Used a template, I thought there must be an easier way, but not much entities have extra attributes so it’s not a big deal or large amount or work.

The new Entity card with attribute
attribute: uptime

3 Likes

Nice. How long has that been available?

1 Like

It’s pretty new, last 2 versions or so.

1 Like

Officially, it is in version 0.108

1 Like

Took me a little time to work out the formatting so for others out there who find the docs sometimes hard to follow without examples:

      - type: entities
        title: Chance of Rain
        show_header_toggle: false
        entities:
          - type: attribute
            entity: sensor.bom_forecast_place_0
            attribute: Chance of Rain
            name: Chance of Rain Today
            icon: "mdi:weather-rainy"
          - type: attribute
            entity: sensor.bom_forecast_place_1
            attribute: Chance of Rain
            name: Chance of Rain Tomorrow
            icon: "mdi:weather-rainy"
17 Likes

The “attribute” keyword doesn’t actually seem to do anything in the entities card, except remove the switch and replace it with a “-”. I was hoping to get something more interesting than the “-”, but I can’t figure out how to make it so. I sure wish the docs had examples.

type: entities
title: Washer Status
state_color: true
entities:
  - entity: input_boolean.washer
    icon: 'mdi:washing-machine'
    secondary_info: last-changed
    type: attribute
    attribute: this does nothing
  - entity: sensor.washer_power_sensor
  - entity: input_select.washer_notify

Attribute is to get a entity’s attribute. input_boolean’s don’t have many attributes. What are you trying to show? I think you’re using the wrong type and expecting it to work without understanding what an attribute is.

Quite possibly. I’m trying to get it to show the “state” attribute of of the input_boolean.washer.
Under the “attribute:” key I’ve tried various things like state, input_boolean.washer, input_boolean.washer.state, state.input_boolean.washer, state.input_boolean.washer.state but nothing changes no matter what I use: Screenshot_2020-07-29 14.03.16_f4b2Lf

If I remove type: and attribute:, I get a switch to control the state – which is NOT what I want. I just want to display the state as “ON” or “OFF”. The rest of it is doing what I want - the icon is correctly colorized to show the state (state_color: true), the secondary_info is working fine. But I definitely don’t want a switch (this is actually a ‘virtual’ sensor based on a power consumption level), and the ‘-’ that I get kind of bugs me.

On your response I tried messing with it again with some limited success. If you use the attribute friendly_name, that does what you would expect. But not editable, which is also an attribute of an input_boolean. So I guess I need to refine my complaint, or perhaps offer some instruction to those others who are wondering how to use this:

  1. Use an attribute name as shown in the “developer tools”, “states” page for your entity.
  2. Use just the bare attribute name
  3. You can’t show ‘state’ itself
  4. Only some of the attributes work
    Example:
  - entity: input_boolean.washer
    type: attribute
    attribute: friendly_name
2 Likes

The state of a entity is not an attribute. If you just want the word on or off, you’ll have to make a template sensor and display that in the UI.

    binary_sensor:
    - platform: template
      sensors:
        washer:
          value_template: >
            {{ states(‘input_boolean.washer’) }}

Edit: I’m on mobile and don’t have access to the correct quote types. Replace the quotes in the template with the non-fancy kind.

1 Like

Here you go man.

    binary_sensor:
    - platform: template
      sensors:
        washer:
          value_template: >
            {{ states('input_boolean.washer') }}
2 Likes

yeah, that’s the ticket.

1 Like

Trying to get an attribute from an entity to display in a horizontal stack. Not sure if I have the syntax wrong or if this isn’t possible in this context. Returns "Entity is non-numeric: climate.sensi_thermostat" so it’s probably not returning the attribute as I want and rather the default state.

cards:
  - entity: sensor.temperature_mean
    max: 40
    min: -20
    name: Outdoor
    severity:
      green: 19
      red: 27.5
      yellow: 22
    type: gauge
  - entity: climate.sensi_thermostat
    attribute: current_temperature
    max: 40
    min: 0
    name: Indoor
    severity:
      green: 20
      yellow: 23.1
      red: 25
    type: gauge
type: horizontal-stack

Oh I see it’s because the type is gauge. If I switch that to entity it works. So the gauge type would have to support attribute which it currently does not. Guess I will have to work around it with a template again. Sigh.

So I assume the state of those two entities isn’t the value you are after?

Right. I’m trying to get the attribute value not the state. So…

  - entity: climate.sensi_thermostat
    attribute: current_temperature

… complains the value is non-numeric. I know the attribute value IS numeric. I can get / use it via a template fine and if I switch from gauge to entity it gives the expected numeric attribute value. My guess is it’s just ignoring the attribute line and returning the state (heat, cool, off, etc).

So my assumptions at this point is gauge does not support the attribute property (or whatever you call it) like entity does.

1 Like

Why the heck don’t the UI cards like Gauge support an attribute!?
It seems like such an unnecessary, inconvenient limitation.

Like sure, you can create a gauge, you just can’t use it with half the the things you have data for. Why?

12 Likes

+1 on this one!

1 Like