Lovelace: Bar Card

The title option is now used to define the header title. If you want to rename the title inside the bar you have to use name instead.

I actually use this property in my theme. And I would like to stay it this color. :smiley:
It would be nice to keep the containerbar background color when the entity is not available.
I tried to look for a way through styles with chrome dev tools, but I couldn’t.

Yeah that’s what I thought. I’ll have a look to see if there’s a better variable to use and maybe add some more bar card specific theme variables.
I do still think greying out the bar works best as the default unavailable color, but maybe in a different way.

3.0.2 adds bar-card-disabled-color as a theme variable.

Highly recommending adding this to your styles for readability:

style: |-
  bar-card-name {
    text-shadow: 1px 1px 5px black;
  }
  bar-card-value {
    text-shadow: 1px 1px 5px black;
  }  

Makes it so much easier to read the text.

1 Like

Agreed even though I don’t use text shadows myself, however it depends on what theme and bar colors you’re using. I decided to not add the shadow to the text by default, since the default theme text color is also black.

1 Like

It was meant as general advice for people to use :smiley:

1 Like

So it’s doing this now…


If you don’t define a name it uses the entity name. I don’t want any name at all.
It is also adding an icon at the bottom of the bar now as well. Can I prevent that? Found position

          - type: entities
            title: Brother MFC-9335CDW
            show_header_toggle: false
            entities:
              - type: 'custom:hui-horizontal-stack-card'
                cards:
                  - type: 'custom:hui-horizontal-stack-card'
                    cards:
                      - type: 'custom:bar-card'
                        entity: sensor.mfc_9335cdw_black_toner_remaining
                        color: black
                        title_position: 'off'
                        unit_of_measurement: '%'
                        direction: up
                        indicator: auto-vertical
                        width: 3em
                        height: 14em
                        rounding: 10px
                        style: |
                          ha-card {
                            border-radius: 0;
                            box-shadow: none;
                            background: transparent;
                          }
                        icon_position: 'off'
                        saturation: 50%
                        animation: auto
                        speed: 1000
                        delay: 5000
                        min: 0
                        max: 100
                        padding: 4px
                        align: center
                        tap_action: info
                        show_value: true
                        limit_value: false
                        show_minmax: false
                        title: false
                        severity: false
                        target: false
                        attribute: false
                        icon: false
                        charge_entity: false
                        card_style: false
                        icon_style: false
                        title_style: false
                        value_style: false
                        minmax_style: false
                        background_style: false
                        visibility: false
                        decimal: false
                        entities:
                          - entity: sensor.mfc_9335cdw_black_toner_remaining
                      - type: 'custom:bar-card'
                        entity: sensor.mfc_9335cdw_cyan_toner_remaining
                        color: cyan
                        title_position: 'off'
                        unit_of_measurement: '%'
                        direction: up
                        indicator: auto-vertical
                        width: 3em
                        height: 14em
                        rounding: 10px
                        style: |
                          ha-card {
                            border-radius: 0;
                            box-shadow: none;
                            background: transparent;
                          }
                        icon_position: 'off'
                        saturation: 50%
                        animation: auto
                        speed: 1000
                        delay: 5000
                        min: 0
                        max: 100
                        padding: 4px
                        align: center
                        tap_action: info
                        show_value: true
                        limit_value: false
                        show_minmax: false
                        title: false
                        severity: false
                        target: false
                        attribute: false
                        icon: false
                        charge_entity: false
                        card_style: false
                        icon_style: false
                        title_style: false
                        value_style: false
                        minmax_style: false
                        background_style: false
                        visibility: false
                        decimal: false
                        entities:
                          - entity: sensor.mfc_9335cdw_cyan_toner_remaining
                      - type: 'custom:bar-card'
                        entity: sensor.mfc_9335cdw_magenta_toner_remaining
                        color: magenta
                        title_position: 'off'
                        unit_of_measurement: '%'
                        direction: up
                        indicator: auto-vertical
                        width: 3em
                        height: 14em
                        rounding: 10px
                        style: |
                          ha-card {
                            border-radius: 0;
                            box-shadow: none;
                            background: transparent;
                          }
                        icon_position: 'off'
                        saturation: 50%
                        animation: auto
                        speed: 1000
                        delay: 5000
                        min: 0
                        max: 100
                        padding: 4px
                        align: center
                        tap_action: info
                        show_value: true
                        limit_value: false
                        show_minmax: false
                        title: false
                        severity: false
                        target: false
                        attribute: false
                        icon: false
                        charge_entity: false
                        card_style: false
                        icon_style: false
                        title_style: false
                        value_style: false
                        minmax_style: false
                        background_style: false
                        visibility: false
                        decimal: false
                        entities:
                          - entity: sensor.mfc_9335cdw_magenta_toner_remaining
                      - type: 'custom:bar-card'
                        entity: sensor.mfc_9335cdw_yellow_toner_remaining
                        color: yellow
                        title_position: 'off'
                        unit_of_measurement: '%'
                        direction: up
                        indicator: auto-vertical
                        width: 3em
                        height: 14em
                        rounding: 10px
                        style: |
                          ha-card {
                            border-radius: 0;
                            box-shadow: none;
                            background: transparent;
                          }
                        icon_position: 'off'
                        saturation: 50%
                        animation: auto
                        speed: 1000
                        delay: 5000
                        min: 0
                        max: 100
                        padding: 4px
                        align: center
                        tap_action: info
                        show_value: true
                        limit_value: false
                        show_minmax: false
                        title: false
                        severity: false
                        target: false
                        attribute: false
                        icon: false
                        charge_entity: false
                        card_style: false
                        icon_style: false
                        title_style: false
                        value_style: false
                        minmax_style: false
                        background_style: false
                        visibility: false
                        decimal: false
                        entities:
                          - entity: sensor.mfc_9335cdw_yellow_toner_remaining

But it’s pushed the text in the bar now up the top
image

                        style: |
                          ha-card {
                            border-radius: 0;
                            box-shadow: none;
                            background: transparent;
                          bar-card-value {
                            margin-right: auto;
                            margin-left: auto;
                            margin-bottom: 0px;
                            margin-top: auto;
                            bottom 8px;

I’m sure it’s this style? But what do I need to change?

Thanks!
Personally I would prefer to have the disabled color same as the enabled background color, to look as an empty bar, every bar each own color.
But can work with one for all as well.

image

entities:
  - type: 'custom:hui-horizontal-stack-card'
    cards:
      - entities:
          - color: black
            entity: sensor.example
          - color: '#57DAFD'
            entity: sensor.example
          - color: '#FF35C5'
            entity: sensor.example
          - color: '#F9D95E'
            entity: sensor.example
        entity_row: true
        direction: up
        height: 200px
        positions:
          icon: 'off'
          indicator: 'off'
          title: 'off'
        stack: horizontal
        type: 'custom:bar-card'
        style: |-
          bar-card-value {
            margin-top: auto;
          }
      - type: picture
        image: https://sg-next.imgix.net/medias/sys_master/root/h12/h3e/9770869850142/laserprinter-800x600.jpg
type: entities

1 Like

I just tried this and you’ve convinced me of doing the empty background instead of a gray background. Fixed in 3.0.3. You can still set bar-card-disabled-color in the theme to override the color.
image

Perfect!
Thanks!

Wow!! Thanks for that. Much simpler… I will implement that tomorrow for sure.

1 Like

have this setup:

and though I have set titles for the bars, the friendly_names of the sensors are displayed.

  - type: custom:bar-card
    style: |
      ha-card {
        box-shadow: none;}
#        columns: 5
    stack: horizontal
    entity_row: true
    direction: up
#   positions:
#      icon: 'inside'
#      indicator: 'off'
#      title: 'top'
    entities:
       - color: black
         entity: sensor.epson_ink_level_black
         title: Black
       - color: 'cyan'
         entity: sensor.epson_ink_level_cyan
         title: Cyan
       - color: 'magenta'
         entity: sensor.epson_ink_level_magenta
         title: Magenta
       - color: 'yellow'
         entity: sensor.epson_ink_level_yellow
         title: Yellow
       - color: 'grey'
         entity: sensor.epson_ink_level_waste
         title: Waste
    height: 150px
    max: 100
    min: 0
#    padding: 2px
    target: 20
#    title_position: bottom
#    align: center-split
#    icon_position: inside
    unit_of_measurement: '%'
    width: 100%

If I enable the positions field, the bars aren’t displayed at al… and I don’t see any error logged
using bar-card 3.0.2, HA 107.5
what could be wrong? thanks for having a look

title is now only used for the header title, you’ll have to use name instead to change the names inside the bars.
Also top is not an option for positions: title:.

I used to see the animation but after my sd card crashed and after reinstalling everything from scratch. I am unable to do so . Anything particular to check for troubleshooting?
Thank you

thanks! overlooked that, sorry…

much better (also corrected the IP address which was changed because of a router reboot… now I have values again :wink: ):

How come the unused parts in the bar are now all grey, while in the one I posted above they had the base color in a grayscale variant? Secondly, as you can see the black percentage is hardly visible, how can that be changed?

The animation is disabled by default now. You’ll have to enable it with the animation config option https://github.com/custom-cards/bar-card#animation-options.

I keep seeing that black bar in people’s printer cards (who the hell still uses printers anyway :wink: ). But there’s a couple of things you can do. Either set the bar to gray instead of black or add a white text shadow to the value using card-mod.

Also the background being more gray is just a trick of the eye because the bar is fuller (classic contrast perception thing). If you actually sample the colors they are exactly the same.