I had very customized badges, custom shapes acording to status, custom colors with templates, all the same size;, and now they are gone, and these so-called-beautifull-new-badges simpy do not replace old layout. Why kill a feature like this???
I spent A LOT of time customizing this, gave them a lot of love, and now, not even the chance to keep old format with existing customizations??? Why???
Just to explain the amout of customization, this is the code associated with the 2nd badge of the top image:
card_mod:
style:
ha-state-label-badge:
$:
ha-label-badge:
$: |
.badge-container .label-badge {
border: solid 3px;
border-top-style:
{%- if states('binary_sensor.modo_dormir') == 'on' -%}
solid
{%- elif states('binary_sensor.modo_cozinha') == 'on' -%}
dotted
{%- elif states('vacuum.roborock_q7_max') == 'cleaning' -%}
solid
{%- elif states('binary_sensor.modo_refeicao') == 'on' -%}
solid
{%- elif states('input_boolean.duche') == 'on' -%}
dotted
{%- elif states('input_boolean.modo_visitas') == 'on' -%}
solid
{%- elif states('input_boolean.modo_criancas') == 'on' -%}
solid
{%- elif states('input_boolean.modo_filme') == 'on' -%}
dashed
{%- elif states('input_boolean.modo_maquilhagem') == 'on' -%}
solid
{%- elif states('binary_sensor.modo_ferias') == 'on' -%}
solid
{%- elif states('input_boolean.modo_lareira') == 'on' -%}
dotted
{%- else -%}
solid
{%- endif %};
border-bottom-style:
{%- if states('binary_sensor.modo_dormir') == 'on' -%}
solid
{%- elif states('binary_sensor.modo_cozinha') == 'on' -%}
solid
{%- elif states('vacuum.roborock_q7_max') == 'cleaning' -%}
dotted
{%- elif states('binary_sensor.modo_refeicao') == 'on' -%}
solid
{%- elif states('input_boolean.duche') == 'on' -%}
dotted
{%- elif states('input_boolean.modo_visitas') == 'on' -%}
solid
{%- elif states('input_boolean.modo_criancas') == 'on' -%}
solid
{%- elif states('input_boolean.modo_filme') == 'on' -%}
solid
{%- elif states('input_boolean.modo_maquilhagem') == 'on' -%}
solid
{%- elif states('binary_sensor.modo_ferias') == 'on' -%}
solid
{%- elif states('input_boolean.modo_lareira') == 'on' -%}
solid
{%- else -%}
solid
{%- endif %};
border-left-style:
{%- if states('input_boolean.modo_lareira') == 'on' -%}
dashed
{%- else -%}
solid
{%- endif %};
border-right-style:
{%- if states('input_boolean.modo_lareira') == 'on' -%}
dashed
{%- else -%}
solid
{%- endif %};
color:
{%- if states('binary_sensor.modo_dormir') == 'on' -%}
purple
{%- elif states('binary_sensor.modo_cozinha') == 'on' -%}
mediumturquoise
{%- elif states('vacuum.roborock_q7_max') == 'cleaning' -%}
mediumaquamarine
{%- elif states('binary_sensor.modo_refeicao') == 'on' -%}
tomato
{%- elif states('input_boolean.duche') == 'on' -%}
cyan
{%- elif states('input_boolean.modo_visitas') == 'on' -%}
yellow
{%- elif states('input_boolean.modo_criancas') == 'on' -%}
yellow
{%- elif states('input_boolean.modo_filme') == 'on' -%}
coral
{%- elif states('input_boolean.modo_maquilhagem') == 'on' -%}
orangered
{%- elif states('binary_sensor.modo_ferias') == 'on' -%}
deepskyblue
{%- elif states('input_boolean.modo_lareira') == 'on' -%}
darkorange
{%- else -%}
darkgray
{%- endif %} !important;
}
.: |
:host {
--ha-label-badge-border-radius:
{%- if states('binary_sensor.modo_dormir') == 'on' -%}
30%
{%- elif states('binary_sensor.modo_cozinha') == 'on' -%}
5% 5% 40% 40%
{%- elif states('vacuum.roborock_q7_max') == 'cleaning' -%}
40% 40% 5% 5%
{%- elif states('binary_sensor.modo_refeicao') == 'on' -%}
30%
{%- elif states('input_boolean.duche') == 'on' -%}
5%
{%- elif states('input_boolean.modo_visitas') == 'on' -%}
30%
{%- elif states('input_boolean.modo_criancas') == 'on' -%}
30%
{%- elif states('input_boolean.modo_filme') == 'on' -%}
0% 0% 15% 15%
{%- elif states('input_boolean.modo_maquilhagem') == 'on' -%}
30%
{%- elif states('binary_sensor.modo_ferias') == 'on' -%}
30%
{%- elif states('input_boolean.modo_lareira') == 'on' -%}
40% 40% 5% 5%
{%- else -%}
30%
{%- endif %};
--ha-label-badge-size: 50px;
--ha-label-badge-title-width: 57px;
--label-badge-background-color: {% if states('binary_sensor.presenca_casa') == 'on' %} #024f23 {% else %} #6a3f07 {% endif %};
--mdc-icon-size: 40px;
}
And this one to the first badge:
card_mod:
style:
ha-state-label-badge:
$:
ha-label-badge:
$: |
.badge-container .label-badge {
border: solid 3px;
box-shadow: inset 0px 0px 0px 0px greenyellow;
color:
{%- if states('alarm_control_panel.alarme_geral') == 'armed_away' -%}
greenyellow
{%- elif states('alarm_control_panel.alarme_geral') == 'armed_home' -%}
mediumturquoise
{%- elif states('alarm_control_panel.alarme_geral') == 'armed_night' -%}
purple
{%- elif states('alarm_control_panel.alarme_geral') == 'armed_vacation' -%}
deepskyblue
{%- elif states('alarm_control_panel.alarme_geral') == 'arming' -%}
orange
{%- elif states('alarm_control_panel.alarme_geral') == 'disarmed' -%}
darkgray
{%- elif states('alarm_control_panel.alarme_geral') == 'pending' -%}
tomato
{%- elif states('alarm_control_panel.alarme_geral') == 'triggered' -%}
red
{%- else -%}
darkgray
{%- endif %} !important;
}
.: |
:host {
--ha-label-badge-border-radius: {% if states('alarm_control_panel.alarme_geral') == 'disarmed' %} 30% {% else %} 15% 15% 55% 55% {% endif %};
--ha-label-badge-size: 50px;
--ha-label-badge-title-width: 57px;
--mdc-icon-size: 32px;
--label-badge-background-color: {% if states('binary_sensor.porta_principal_contact') == 'on' %} #599627 {% else %} var(--primary-background-color) {% endif %};
}
And this one to the last badge:
card_mod:
style:
ha-state-label-badge:
$:
ha-label-badge:
$: |
.badge-container .label-badge {
border: solid 3px;
color: {{ 'red' if states('switch.localtuya_power_01') == 'on' else 'gray' }} !important;
background-color:
{%- from 'interpolate_rgb.jinja' import interpolate_rgb -%}
{%- set temp = states(config.entity) | float(0) -%}
{%- set temp_map = {
20: "0000ff",
30: "00ffff",
35: "66cdaa",
40: "3cb371",
45: "32cd32",
50: "ffff00",
55: "ffd700",
60: "ffa500",
65: "ff4500",
70: "ff0000",
75: "8b0000"
} -%}
{%- set keys = temp_map | sort -%}
{%- set index = keys | select("lt", temp) | list | length -%}
{%- if index == 0 -%}
#{{ temp_map[keys | first] }}
{%- elif index == keys | length -%}
#{{ temp_map[keys | last] }}
{%- else -%}
{%- set start = (keys[index - 1], temp_map[keys[index - 1]]) -%}
{%- set stop = (keys[index], temp_map[keys[index]]) -%}
{{ interpolate_rgb(temp, start, stop) }}
{%- endif -%};
}
.badge-container .label-badge .value {
color:
{% if states('sensor.painel_solar_temperature')|int(default=0) < 20 %} cyan
{% elif states('sensor.painel_solar_temperature')|int(default=0) < 38 %} midnightblue
{% elif states('sensor.painel_solar_temperature')|int(default=0) < 55 %} darkgreen
{% elif states('sensor.painel_solar_temperature')|int(default=0) < 65 %} yellow
{% else %} orange {% endif %};
font-weight: regular;
margin-top: -2px;
}
.badge-container .label-badge .label span {
background-color: {{ 'red' if states('switch.localtuya_power_01') == 'on' else 'gray' }} !important;
}
.: |
:host {
--ha-label-badge-border-radius: 30%;
--ha-label-badge-size: 50px;
--ha-label-badge-title-width: 57px;
--ha-label-badge-font-size: 22px;
}
How can I keep this??? Please?