Lovelace: Bar Card

If you mean the header title, that’s not possible since the whole point of entity_row is that it removes all of that.

Ok, thanks

why is there so much space between the beams?

my config:

       - type: custom:stack-in-card
         mode: vertical
       #- type: custom:vertical-stack-in-card
         cards:
         - type: entities       
           #title: Batteriestände
           show_header_toggle: false
          # columns: 3
           entities:
             - type: custom:text-divider-row
               text: Tasmota IP
             - script.tasmota_ip
             - sensor.sonoff_ip
             - type: custom:text-divider-row
               text: Batterie Level
             - sensor.low_battery
             - automation.batterie_alarm 
             - type: divider            
             - type: 'custom:auto-entities'
               card:
                 type: 'custom:bar-card'
                 style: |-
                   bar-card-value {
                     margin-right: right;
                     font-size: 10px;
                     text-shadow: 1px 1px #0005;
                   }
                 columns: 2
                 width: 100%
                 height: 25px
                 title_position: inside
                 align: split
                 rounding: 0px
                 severity:
                   - color: '#ff0000'
                     from: 0
                     to: 10
                   - color: '#bf4040'
                     from: 11
                     to: 25
                   - color: '#d3db39'
                     from: 26
                     to: 70
                   - color: '#40bf40'
                     from: 71
                     to: 100
                 unit_of_measurement: '%'
               sort:
                 method: name
               filter:
                 include:
                   - entity_id: sensor.*battery*
                     state: <=101

You need to set entity_row to true. However this was broken in 3.0.7 when using it in combination with columns so I’ve fixed it in 3.0.8.

1 Like

thanks this works!

Why does the bar extend to the right? and why is the icon not centered?

Immagine

    - type: custom:vertical-stack-in-card
      title: Stato Batterie
      cards:
        - type: 'custom:text-divider-row'
          text: Movimento
        - type: 'custom:bar-card'
          entity: sensor.batteria_movimento_soggiorno
          name: Soggiorno
          height: 30px
          entity_row: true
          positions:
            title: inside
          severity:
            - color: Red
              from: 0
              to: 25
            - color: Orange
              from: 26
              to: 50
            - color: Green
              from: 51
              to: 100
        - type: 'custom:bar-card'
          entity: sensor.batteria_movimento_bagno_servizio
          name: Bagno Servizio
          height: 30px
          entity_row: true
          positions:
            title: inside
          severity:
            - color: Red
              from: 0
              to: 25
            - color: Orange
              from: 26
              to: 50
            - color: Green
              from: 51
              to: 100
        - type: 'custom:bar-card'
          entity: sensor.batteria_movimento_disimpegno 
          name: Disimpegno
          height: 30px
          entity_row: true
          positions:
            title: inside
          severity:
            - color: Red
              from: 0
              to: 25
            - color: Orange
              from: 26
              to: 50
            - color: Green
              from: 51
              to: 100

It’s because you’re using entity_row outside of an entities card. You also don’t have to define each bar as a separate card, you can define multiple bars in a single bar-card using the entities config option just like inside an entities card.

ok, but if the entities have different bar customization ( different max, different target)?

I would set up the whole thing like this, but you can use vertical-stack-in-card as well. Every bar-card entity in the entities list can have it’s own config.

type: entities
title: Stato Batterie
entities:
  - type: 'custom:text-divider-row'
    text: Movimento
  - type: 'custom:bar-card'
    height: 30px
    entity_row: true
    positions:
      title: inside
    entities:
      - entity: sensor.batteria_movimento_soggiorno
        name: Soggiorno
        severity:
          - color: Red
            from: 0
            to: 25
          - color: Orange
            from: 26
            to: 50
          - color: Green
            from: 51
            to: 100
      - entity: sensor.batteria_movimento_bagno_servizio
        name: Bagno Servizio
        severity:
          - color: Red
            from: 0
            to: 25
          - color: Orange
            from: 26
            to: 50
          - color: Green
            from: 51
            to: 100
      - entity: sensor.batteria_movimento_disimpegno
        name: Disimpegno
        severity:
          - color: Red
            from: 0
            to: 25
          - color: Orange
            from: 26
            to: 50
          - color: Green
            from: 51
            to: 100

Thx i have fix it.

I have another question: why does this sensor not show the battery?
Immagine

This is something I will have to fix, but I’m currently reworking the card to use the custom card boilerplate template so it might take a couple of days. For now you can set the icon config option.

Hi, i have the same problem.
No icon in battery bar. do you solve it ?
Thanks

Her is my config after updating to the current version:

  - type: custom:vertical-stack-in-card
    title: Batterien
    cards:
      - type: custom:auto-entities
        card:
          type: custom:bar-card
          attribute: battery
          unit_of_measurement: "V"
          positions:
            icon: 'off'
            indicator: 'off'
            title: inside
          min: 0
          max: 3.1
          color: Green
          severity:
          - color: Red
            from: 0
            to: 2.1
          - color: Orange
            from: 2.2
            to: 2.4
        filter:
          include:
          - attributes:
              battery: "<=100"
      - type: custom:auto-entities
        card:
          type: custom:bar-card
          attribute: battery
          unit_of_measurement: " "
          positions:
            icon: 'off'
            indicator: 'off'
            title: inside
          color: Green
          severity:
          - color: Red
            value: Low
        filter:
          include:
          - attributes:
              battery: Low
          - attributes:
              battery: High

Now I have the problem that for all bars with value Low or High the color is the “darker” color of the bar, not the “bright” one. See the green color in this screenshot:

Bildschirmfoto 2020-04-14 um 14.33.10

How can I fix this so that always the bright color is used?

Thanks!

This seems like a bug, when the value is a string it should show a full bar. I’ll try to fix it in the next release.

1 Like

Hello…I would like to use the bar card for displaying the postion of my shutters. This works fine if the shutters are open (100%) or partialy closed, but when they are closed, they have the value 0%, which means the bar has nothing to display:

image

Is it possible to set the bar to, for example red, if the value is 0?

Thank you,
Philipp

No this isn’t possible since the bar is made to just display the amount of the value. However you could maybe make a template sensor that changes the value to Closed which will make the bar display as if it’s full.

Been tearing my hair out trying to figure this out, using bar-card to report RasPi system stats but I can’t get the black borders around each bar to shrink.

image

Ideally I would like it layed out the same as the screenshot in the iOS Dark Mode Theme readme but I just can’t figure it out, any help appreciated!!! Thanks

image

Not sure if you want exactly that in the screenshot but I’d recommend either putting everything into a single card or enabling entity_row.
What’s in that screenshot was actually a bit of a bug since it always draws the HA card around the bar.
If you do want exactly that you can probably do it with some CSS magic.

Does this or how does this work? I have a sensor that has attributes associated with it so the sensor:

sensor.homeserver_c_drive_used

If I go into Developer Tools and Templates and put in:

{{ states.sensor.homeserver_c_drive_used.attributes.maximum }}

I get a result. But trying to emulate what you have for max doesn’t seem to work for me.

Not sure if you want exactly that in the screenshot but I’d recommend either putting everything into a single card or enabling entity_row .

Or maybe GitHub - ofekashery/vertical-stack-in-card: 📐 Home Assistant Card: Group multiple cards into a single sleek card.