Badge color change

Hello,

I have the Fonske Marstek modbus TCP/IP running for my home batteries.
In top of the screen there are 2 badges which show the level of the batteries.
Red/Orange/green.

Is it possible to change the color red into purple and orange into yellow?

Thx in advance!

I believe it is possible to template that with 3rd party cards, but otherwise it is a theme thing I think.
(Not an expert, though, but your post was getting stale so I thought I would add my 2 cents)

This might help… Tips on Searching for Answers & Duplicate Topics in the Forum

2 Likes

I uses the mushroom theme/cards and cardmod integration from HACS. Please look at my code for the shower temp and try to implement for your icons. Or am I misunderstanding you, and you just want to swap the existing colours? What is the code of your badges? Normally you are able to change the colors, as you want.

Good luck. :wink:

type: custom:mushroom-template-badge
content: "{{ states('sensor.speicher_temperature') }}°C"
icon: mdi:shower-head
color: |-
  {% set temp = states('sensor.speicher_temperature') | float %}
    {% if temp < 38 %}
      blue
    {% elif temp < 42 %}
      orange
    {% else %}
      red
    {% endif %}
entity: sensor.speicher_temperature
area: hausanschlussraum

1 Like

Hello,

Thanks a lot guys. It worked for me. Here is my yaml for my solution

type: custom:mushroom-template-badge content: "{{ states('sensor.marstek_m1_battery_state_of_charge') }}" icon: mdi:power-plug-battery-outline color: |- {% set battery = states('sensor.marstek_m1_battery_state_of_charge') | float %} {% if battery < 30 %} Purple {% elif battery < 80 %} Lime {% else %} Green {% endif %} entity: sensor.marstek_m1_battery_state_of_charge area: garage

Great :sunglasses:. A little hint: Feel you free to replace the lines/words

set temp

and

temp

to

set battery

and

battery

It’s not compulsory, but it’s more pleasing to the eye. :joy:

Ow ok, didn’t saw that. I’m the worst computer user :joy: