To monitor my raspberry, I have a vertical stack + bar-card, but I have the problem that every bar takes different size depending on the value as shown below:
Is there a way to have them with the same size?
Current code is:
- type: vertical-stack
cards:
# CPU
- type: custom:bar-card
positions:
name: outside
value: outside
indicator: 'off'
height: 20px
width: 60%
entities:
- entity: sensor.cpu_usage_raspi4
name: CPU
icon: mdi:speedometer
severity:
- color: rgb(26,204,147,0.33)
from: 0
to: 10.9
- color: rgb(206,133,0,0.60)
from: 11
to: 25
- color: rgb(163,0,0,0.60)
from: 26
to: 150
# Temperature
- type: custom:bar-card
positions:
name: outside
value: outside
indicator: 'off'
height: 20px
width: 60%
entities:
- entity: sensor.temperature_raspi4
name: Temp
icon: mdi:thermometer
severity:
- color: rgb(26,204,147,0.33)
from: 0
to: 69.9
- color: rgb(206,133,0,0.60)
from: 70
to: 85
- color: rgb(163,0,0,0.60)
from: 85
to: 150
# Disk
- type: custom:bar-card
positions:
name: outside
value: outside
indicator: 'off'
height: 20px
width: 60%
entities:
- entity: sensor.disk_use_raspi4
name: SSD
icon: mdi:harddisk
severity:
- color: rgb(26,204,147,0.33)
from: 0
to: 69.9
- color: rgb(206,133,0,0.60)
from: 70
to: 85
- color: rgb(163,0,0,0.60)
from: 85
to: 150
Having problems to get different colors for each bar.
Background: I want to show colors of ink filled from my printer and display it with appropriate color.
This works but with a caveat.
With card-mod I can change the colors but not one of the 3 bars.
So in the above scenario with 3 bars I had to use a horizontal-stack with 3 separate bars of which the middle one gets a different color.
Card-mod may be specified for all bars or some particular.
Do you mean you can have a single bar-card with 3 bars and use card-mod to change the color of 1 of these bars? (vs. adding 3 bar-cards of which 1 uses card-mod)
Thanks, that works. By hiding it, I meant hiding the bar itself. I found that the “severity” option can have a “hide” option, but how do I format the boolean? hide: {{ is_state('sensor.tpms_f1a819c8', 'unknown') }} doesn’t seem to work.
- type: custom:bar-card
entities:
- entity: sensor.battery_samsung_p6800
direction: right
name: Battery
icon: mdi:battery
severity:
- from: 10
to: 20
color: var(--disabled-text-color)
icon: mdi:battery-alert
- from: 21
to: 30
hide: true
Then change a value of the sensor.battery_samsung_p6800:
And if the value = 29:
In some cases this “hiding the bar” may not look fine for you due to it’s vertical sizes.
Probably, if the bar-card is placed between entity-rows the hiding will look better, check it by yourself.
You cannot use this:
severity:
- from: unknown
to: unknown
Here you are trying to use a template:
which is not supported.
How to hide by using “card-mod”:
Let’s consider a bar-card inside a stack:
Cool! Thanks so much for the help.
Another question, if I may: it seems that the bar-card cannot display the label, or any other attributes of the entity. What would be the best way to go to display for example the label below the name? I am experimenting with vertical stack, but I do not want a spacing (card borders) between the name and the label.
Forever in your debt
Sorry, you’re right.
The bar card is the tpms sensor, name is on bottom, value (state) is on top, the card has min-max value set to 200-300 kPa.
I’d like to add the temperature and potentially a last_changed value at the bottom for each sensor. The temperature is an attribute of the corresponding tpms sensor.