Heute hätte ich gern e eure Hilfe beim Styling von Badges.Bisher habe ich in vielen Karten eine Fußzeile, die mir den Status mehrerer Entitäten anzeigt.Das sieht etwa so aus:
- type: heading
icon: none
heading: ""
badges:
- type: entity
show_state: true
show_icon: true
entity: sensor.thermostat_buro_kg_ist_temperatur
color: red
tap_action:
action: more-info
- type: entity
show_state: true
show_icon: true
entity: sensor.thermostat_buro_kg_luftfeuchtigkeit
color: blue
tap_action:
action: more-info
- type: entity
show_state: true
show_icon: true
entity: sensor.steckdose_m3_leistung
color: orange
tap_action:
action: more-info
![]()
Da ich es nicht geschafft habe, die entity-Badges dynamisch zu stylen, habe ich es mit mushroom-template-cards versucht. Das funktioniert auch im Prinzip ganz gut:
- type: heading
icon: none
heading: ""
badges:
- type: custom:mushroom-template-card
entity: sensor.shelly_zisterne_analogeingang_analog
primary: ""
icon: mdi:car-coolant-level
icon_color: >-
{%- set value =
states('sensor.shelly_zisterne_analogeingang_analog_value') | round(0)
-%} {%- if value > 60 -%}
blue
{%- elif value > 25 -%}
skyblue
{%- elif value >15 -%}
lightcoral
{%- else -%}
mediumvioletred
{%- endif -%}
secondary: >
{%- set value =
states('sensor.shelly_zisterne_analogeingang_analog_value') | float
|round(0) -%} {%- set unit =
state_attr('sensor.shelly_zisterne_analogeingang_analog_value',
'unit_of_measurement') -%} {{value}} {{unit}}
tap_action:
action: more-info
card_mod:
style: |
ha-card {
border: none;
padding: 0px !important;
margin-bottom: -10px;
margin-top: -10px;
}
- type: custom:mushroom-template-card
entity: sensor.stromaufnahme_ladestation_total_active_power
primary: ""
icon: mdi:ev-station
icon_color: >-
{%- set value =
states('sensor.stromaufnahme_ladestation_total_active_power') | float
-%}
{%- set unit =
state_attr('sensor.stromaufnahme_ladestation_total_active_power',
'unit_of_measurement') -%} {%- set threshold = 10 if unit == 'W' else
0.01 -%} {%- if value > threshold -%}
gold
{%- else -%}
grey
{%- endif -%}
secondary: >
{%- set value =
states('sensor.stromaufnahme_ladestation_total_active_power') | int
-%} {%- set unit =
state_attr('sensor.stromaufnahme_ladestation_total_active_power',
'unit_of_measurement') -%} {{value}} {{unit}}
tap_action:
action: more-info
card_mod:
style: |
ha-card {
border: none;
padding: 0px !important;
margin-bottom: -10px;
margin-top: -10px;
}

Aber ich schaffe es nicht, das Aussehen den anderen Badges anzupassen. Das betrifft die Größe, den Abstand von Icon zu Text etc.Kann mir da jemand weiterhelfen?Entweder die mushroom-Karte zu Stylen, oder das mit einer entity-Karte hinzubekommen?EDIT:Ich habe es jetzt mit mushroom-template-badge umgesetzt und das sieht schon den anderen Badges sehr ähnlich:
- type: custom:mushroom-template-badge
entity: sensor.shelly_zisterne_analogeingang_analog_value
icon: mdi:car-coolant-level
color: >
{% set value = states(entity) | float %} {% if value > 60 %} blue {%
elif value > 25 %} skyblue {% elif value > 15 %} lightcoral {% else %}
mediumvioletred {% endif %}
content: >
{% set value = states(entity) | float | round(0) %} {% set unit =
state_attr(entity, 'unit_of_measurement') %} {{ value }} {{ unit }}
tap_action:
action: more-info
card_mod:
style:
mushroom-state-info$: |
.content {
white-space: nowrap !important;
}

Allerdings schaffe ich es hier nicht den Zeilenumbruch weg zu bekommen und den Rahmen leider auch nicht.