In my dashboard I have the following code used to change the color of text based on device readings. For example, if a device is wet (leak detector) the dashboard reading will be green or red. With the 2025.1 update, the text only displays at the standard white. Any ideas?
- entity: binary_sensor.sump_right_leak_moisture
name: Sump Leak
card_mod:
style:
hui-generic-entity-row $: >
state-badge {
display: inline-block; # Ensure the icon is visible
}
.state {
color: {% if is_state('binary_sensor.sump_right_leak_moisture',
'off') %} green {% else %} red {% endif %};
}
Another example:
- entity: sensor.meter_74dd_carbon_dioxide
name: Carbon Dioxide CO2
icon: mdi:molecule-co2
card_mod:
style:
hui-generic-entity-row $: |
state-badge {
display: inline-block; # Ensure the icon is visible
}
.state {
color: {% set co2_value = states('sensor.meter_74dd_carbon_dioxide') | float %}
{% if co2_value < 800 %}
green
{% elif co2_value >= 800 and co2_value <= 1000 %}
yellow
{% else %}
red
{% endif %}
}