rebuilt my Home Assistant card to use regular entities card (because of the current bard-card being unmaintained.) It isnt the same, but it does have a nice ring to it. Picture needs some further tweaking (so it doesnt repeat and still is the correct size/proportion.)
and a variation with some tighter paddings, so the individual entities have a bit more space horizontally. can also change margins:
padding: 0px 16px;
/*margin: 0px -16px;*/
so do as you please there
Yaml
# green #0, 128, 0
# darkgreen #0, 100, 0
# limegreen 50, 205, 50
# gold 255, 215, 0
# brown # 165, 42, 42
# orange #255, 165, 0
# darkorange #255, 140, 0
# orangered #255, 69, 0
# tomato # 255, 99, 71
# maroon #128, 0, 0
# red #255, 0, 0
type: entities
card_mod:
style: |
ha-card {
background:
{% set dark = is_state('binary_sensor.donker_buiten','on') %}
url('/local/homeassistant/homeassistant{{"-dark" if dark }}.png');
color: white;
--card-mod-icon-color: white;
font-weight: bold;
padding-top: 40px;
}
entities:
- entity: sensor.last_boot
- entity: sensor.processor_use
<<: &perc
card_mod:
style: |
hui-generic-entity-row {
padding: 0px 16px;
border-radius: 24px;
background:
{% set perc = states(config.entity)|float(0) %}
{% set rest = 100 - perc %}
{% if perc >= 59 %} {% set bar = '255, 0, 0' %}
{% elif perc >= 44 %} {% set bar = '128, 0, 0' %}
{% elif perc >= 24 %} {% set bar = '255, 165, 0' %}
{% elif perc >= 9 %} {% set bar = '0, 100, 0' %}
{% else %} {% set bar = '0, 128, 0' %}
{% endif %}
/*linear-gradient(to left,ivory {{rest}}%, {{bar}} {{perc}}%);*/
linear-gradient(to right, rgb({{bar}}) 0%, rgb({{bar}}) {{perc}}%, rgba({{bar}},0.2) {{perc}}%, rgba({{bar}},0.2) 100%);
}
name: Cpu
- entity: sensor.processor_temperature
name: Temp
card_mod:
style: |
hui-generic-entity-row {
padding-right: 16px;
padding-left: 16px;
margin: 0px -16px;
border-radius: 24px;
background:
{% set temp = states(config.entity)|float(0) %}
{% set rest = 100 - temp %}
{% if temp >= 85 %} {% set bar = '255, 0, 0' %}
{% elif temp >= 75 %} {% set bar = '128, 0, 0' %}
{% elif temp >= 65 %} {% set bar = '255, 99, 71' %}
{% elif temp >= 55 %} {% set bar = '255, 69, 0' %}
{% elif temp >= 45 %} {% set bar = '255, 140, 0' %}
{% elif temp >= 35 %} {% set bar = '255, 165, 0' %}
{% else %} {% set bar = '0, 128, 0' %}
{% endif %}
/*linear-gradient(to left,ivory {{rest}}%, {{bar}} {{temp}}%);*/
linear-gradient(to right, rgb({{bar}}) 0%, rgb({{bar}}) {{temp}}%, rgba({{bar}},0.2) {{temp}}%, rgba({{bar}},0.2) 100%);
}
- entity: sensor.memory_use_percent
name: Memory
card_mod:
style: |
hui-generic-entity-row {
padding-right: 16px;
padding-left: 16px;
margin: 0px -16px;
border-radius: 24px;
background:
{% set perc = states(config.entity)|float(0) %}
{% set rest = 100 - perc %}
{% if perc >= 85 %} {% set bar = '255, 0, 0' %}
{% elif perc >= 75 %} {% set bar = '128, 0, 0' %}
{% elif perc >= 60 %} {% set bar = '255, 165, 0' %}
{% elif perc >= 50 %} {% set bar = '165, 42, 42' %}
{% else %} {% set bar = '0, 128, 0' %}
{% endif %}
/*linear-gradient(to left,ivory {{rest}}%, {{bar}} {{perc}}%);*/
linear-gradient(to right, rgb({{bar}}) 0%, rgb({{bar}}) {{perc}}%, rgba({{bar}},0.2) {{perc}}%, rgba({{bar}},0.2) 100%);
}
- entity: sensor.disk_use_percent_home
name: Disk
<<: *perc
- entity: sensor.swap_use
name: Swap
card_mod:
style: |
hui-generic-entity-row {
padding-right: 16px;
padding-left: 16px;
margin: 0px -16px;
border-radius: 24px;
background:
{% set swap = states(config.entity)|float(0) %}
{% set rest = 1000 - swap %}
{% set factor = 0.06 %}
{% if swap >= 768 %} {% set bar = '255, 0, 0' %}
{% elif swap >= 640 %} {% set bar = '255, 215, 0' %}
{% else %} {% set bar = '50, 205, 50' %}
{% endif %}
/*linear-gradient(to left,ivory {{rest*factor}}%, {{bar}} {{swap*factor}}%);*/
linear-gradient(to right, rgb({{bar}}) 0%, rgb({{bar}}) {{swap*factor}}%, rgba({{bar}},0.2) {{swap*factor}}%, rgba({{bar}},0.2) 100%);
}
or add a bit of border, alike the original bar-card:
border-radius: 24px; /*7pt*/;
border: 2px solid rgb(49,150,207);
border-shadow: 2pt;
final touch for now: add a bit more color to the rest bar, setting the percentage to 0.6 in the linear -gradient:
linear-gradient(to right, rgb({{bar}}) 0%, rgb({{bar}}) {{perc}}%, rgba({{bar}},0.6) {{perc}}%, rgba({{bar}},0.2) 100%);
since this now is no longer a bar-card, I wont pursue here,
(I want some common mods that apply to all individual entities moved to the top card mod if possible) but given the fact the original was made with bar-card elements in the picture-elements card, I figured it to be relevant
well OMT then
yep, easy
Yaml for some common row height and icon size on the individual entities
type: entities
card_mod:
style:
hui-sensor-entity-row:
$: |
hui-generic-entity-row {
height: 25px;
padding: 0px 16px;
border-radius: 24px;
border: 2px solid rgb(49,150,207);
border-shadow: 2pt;
}
.: |
ha-card {
background:
{% set dark = is_state('binary_sensor.donker_buiten','on') %}
url('/local/homeassistant/homeassistant{{"-dark" if dark }}.png');
color: white;
--card-mod-icon-color: white;
--mdc-icon-size: 20px;
font-weight: bold;
padding-top: 40px;
}
better: