It does mention number but I only see example for a fixed value.
Or is there another way around this?
It does clearly say ānumberā in a table of properties - which is ā123ā.
Your workaround is either using a forked version of this card supporting entities for this property (if this fork exists) or using a custom card supporting templates like config-template-card etc.
Ok, I think I got it working now using config-card thanks to this post
Only issue I have now is the bar exceed the column itās in
Anyway I can edit this so it stays inside?
Also how do I reduce the numbers (remove .0 or %) display so each bar width is smaller?
type: custom:config-template-card
variables:
- states['number.mmwave_g0_still_threshold_2']
- states['number.mmwave_g1_still_threshold_2']
- states['number.mmwave_g2_still_threshold_2']
- states['number.mmwave_g3_still_threshold_2']
- states['number.mmwave_g4_still_threshold_2']
- states['number.mmwave_g5_still_threshold_2']
- states['number.mmwave_g6_still_threshold_2']
- states['number.mmwave_g7_still_threshold_2']
- states['number.mmwave_g8_still_threshold_2']
entities:
- sensor.mmwave_g2_still_energy_2
card:
type: custom:bar-card
title: Still Energy
icon: "no"
height: 100px
width: 100%
direction: up
positions:
indicator: inside
name: inside
value: inside
columns: 9
entities:
- entity: sensor.mmwave_g0_still_energy_2
name: ${vars[0].state}
target: ${vars[0].state}
severity:
- color: Blue
from: 0
to: ${vars[0].state}
- color: Red
from: ${vars[0].state}
to: 100
- entity: sensor.mmwave_g1_still_energy_2
name: ${vars[1].state}
target: ${vars[1].state}
severity:
- color: Blue
from: 0
to: ${vars[1].state}
- color: Red
from: ${vars[1].state}
to: 100
- entity: sensor.mmwave_g2_still_energy_2
name: ${vars[2].state}
target: ${vars[2].state}
severity:
- color: Blue
from: 0
to: ${vars[2].state}
- color: Red
from: ${vars[2].state}
to: 100
- entity: sensor.mmwave_g3_still_energy_2
name: ${vars[3].state}
target: ${vars[3].state}
severity:
- color: Blue
from: 0
to: ${vars[3].state}
- color: Red
from: ${vars[3].state}
to: 100
- entity: sensor.mmwave_g4_still_energy_2
name: ${vars[4].state}
target: ${vars[4].state}
severity:
- color: Blue
from: 0
to: ${vars[4].state}
- color: Red
from: ${vars[4].state}
to: 100
- entity: sensor.mmwave_g5_still_energy_2
name: ${vars[5].state}
target: ${vars[5].state}
severity:
- color: Blue
from: 0
to: ${vars[5].state}
- color: Red
from: ${vars[5].state}
to: 100
- entity: sensor.mmwave_g6_still_energy_2
name: ${vars[6].state}
target: ${vars[6].state}
severity:
- color: Blue
from: 0
to: ${vars[6].state}
- color: Red
from: ${vars[6].state}
to: 100
- entity: sensor.mmwave_g7_still_energy_2
name: ${vars[7].state}
target: ${vars[7].state}
severity:
- color: Blue
from: 0
to: ${vars[7].state}
- color: Red
from: ${vars[7].state}
to: 100
- entity: sensor.mmwave_g8_still_energy_2
name: ${vars[8].state}
target: ${vars[8].state}
severity:
- color: Blue
from: 0
to: ${vars[8].state}
- color: Red
from: ${vars[8].state}
to: 100
- Never ever post an unformatted code. Place a code into triple backquotes.
- Your card-mod code missing a ācard_modā keyword. Check docs for card-mod.
Iām sorry. Iāve never posted on the forum. I can do it, my card is great. How do I post codes?
custom:bar-card
title: ProduĆ§Ć£o Solar
entities:
- entity: sensor.sonoff_1000916c58_power
name: ProduĆ§Ć£o Atual
color: rgba(33, 150, 243, 0.6)
max: 3450
show_state: true
show_icon: false
- entity: sensor.sonoff_1000916c58_energy
name: ProduĆ§Ć£o Dia
color: rgba(33, 150, 243, 0.6)
max: 24
show_state: true
show_icon: false
- entity: input_number.producao_mensal_total
name: ProduĆ§Ć£o MĆŖs
color: rgba(33, 150, 243, 0.6)
max: 650
show_state: true
show_icon: false
direction: up
height: 200px
stack: horizontal
width: 100%
style: |
ha-card {
background: none;
border: none;
}
card_mod:
style: |
bar-card-backgroundbar {
background-image: url('/local/PainelHoy3.png'); /* Imagem do painel solar */
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
border-radius: 0px; /* Sem bordas arredondadas */
}
bar-card-currentbar {
background: rgba(33, 150, 243, 0.6); /* Cor atual da barra */
border-radius: 0px; /* Sem bordas arredondadas */
clip-path: polygon(0 100%, 100% 100%, 100% calc(100% - var(--bar-percent)), 0 calc(100% - var(--bar-percent))); /* Ajusta o preenchimento da barra */
}
bar-card-name, bar-card-value {
text-shadow: 1px 1px black;
}
Just like to share my Barcard LCARS Template Navigation
type: custom:bar-card
entities:
- entity: sensor.aktuelle_temperatur_waschekeller_mittelwert
name: WƤschekeller
tap_action:
action: navigate
navigation_path: /dashboard-lcars/waschekeller
- entity: sensor.hk_ug_bad_temperatur
name: Bad Keller
tap_action:
action: navigate
navigation_path: /dashboard-lcars/bad-keller
- entity: sensor.hk_ug_werkkeller_temperatur
name: Werkkelle
tap_action:
action: navigate
navigation_path: /dashboard-lcars/werkkeller
unit_of_measurement: Ā°C
attribute: false
background_style: false
card_style: false
charge_entity: false
decimal: 0
direction: up
show_icon: true
animation:
state: "on"
severity:
- from: "0"
to: "10"
color: navy
- from: "10.1"
to: "15"
color: mediumslateblue
- from: "15.1"
to: "18.9"
color: skyblue
- from: "19"
to: "21"
color: seagreen
- from: "21.1"
to: "22.9"
color: tomato
- from: "23"
to: "40"
color: crimson
positions:
icon: inside
indicator: "off"
minmax: "off"
name: inside
value: inside
min: 0
max: 40
target: 21
stack: horizontal
card_mod:
style: |
bar-card-value, bar-card-name {
font-weight: bold;
margin-left: auto;
margin-right: auto;
text-shadow: 1px 1px 2px #0009;
}
bar-card-name {
font-size: 1rem;
line-height:1.5rem;
margin-top: 1.85rem;
text-transform:uppercase;
}
bar-card-value {
font-size: 1.25rem;
line-height:.1.3rem;
margin-bottom: 0.75rem;
}
.card-content { text-align: start; padding: 0px; margin: 0px; margin-bottom:
0px; }
ha-card { box-shadow: none;}
ha-icon {
width: auto;
height: auto;
margin-top:2rem;
margin-left:auto;
margin-right:auto;
}
bar-card-row {
--primary-text-color: white;
font-size: 1rem;
}
bar-card-backgroundbar {
border-radius:30px;
}
ha-card {
--card-mod-icon-color: white;
--mdc-icon-size: 4rem;
}
class: middle-right
grid_options:
columns: 12
rows: 2
Hi! Loving this card, thanks! I set up another for my UPS last night. How can I close up the gaps between the bars? Iāve tried a number of style options shown elsewhere and none work.
- There is an option (cannot name it exactly) in bar-card to remove some paddings.
- Card-mod can be also used for styling.
Can card-mod be used? The docs Iāve read say it canāt work on a grid card. If anyone can find the option I need to add Iāll be grateful, as I canāt.
There is a bar-card on your screenshot.
Wrong, card-mod definitely works for a stock Grid card (if you mean this card), there is nothing about a Grid card in Docs for card-mod. (it is only mentioned that cards w/o āha-cardā should be styled by using mod-card - and it is related to Grid card)
I donāt recall where I got the example from, but it was nested inside a grid card. Clearly wrong. Iāve cut down my card to just two sensors and tried to style it. Any idea what Iām doing wrong, please? If I go into Inspect mode, add āheight: 22px;ā to the bar-card-card:last-child{} style, the results look great. I just canāt get the style to work via config.
type: custom:bar-card
height: 25px
style: |
bar-card-card:last-child {
margin-right: 0px;
height: 22px;
}
entities:
- type: sensor
entity: sensor.office_ups_ups_battery_charge
name: UPS Battery Charge
severity:
- from: "0"
to: "33"
color: Red
- from: "33"
to: "66"
color: Amber
- from: "66"
to: "100"
color: Green
- type: sensor
entity: sensor.office_ups_ups_battery_runtime
name: UPS Battery Runtime
max: 30
severity:
- from: "0"
to: "10"
color: Red
- from: "10"
to: "20"
color: Orange
- from: "20"
to: "30"
color: Green
square: false
columns: 1
You copy-pasted this card. You can clearly see a card-mod code. Have you read docs for card-mod?
If not - this is wrong absolutely. Using HA needs reading docs. In short - card-mod code is wrong since it lacks a ācard_modā keyword.
I had. I have the entry for it in configuration.yaml, restarted everything. I tried this at one point and it didnāt work either.
card_mod:
style: |
bar-card-card:last-child {
margin-right: 0px;
height: 22px;
}
I looked at other examples which didnāt show the card_mod: so I tried that. Thatās one annoying thing about using the Internet, thereās plenty wrong examples to muddy the waters.
As for absence of ācard_modā keyword - could be another case: this keyword became mandatory on 2022 (or 2021?).
Cannot test it myself now. Try asking in the main card-mod thread.
So, what was a reason of a failure, why it did not work?
I honestly have no idea, other than maybe something being stuck in a cache? Iād saved the YAML, didnāt see the results I wanted, so got on with some home DIY. A good while later I unlocked my phone to do something unrelated and saw the card had changed. Frustrating!
Do you have the latest version of card-mod installed?
Love these, they look fab.