Badges colour icon from entity status

I think I can leave it like that. Badges change colors and flash on status.

- entity: binary_sensor.garage
        style: >
          @keyframes blinker { 50% { opacity: 0; } }
          :host {
          color: {% if is_state('binary_sensor.garage', 'on') %} red {%else %} white {% endif %};
          --label-badge-red: {% if is_state('binary_sensor.garage', 'on') %} red {% else %} white {%endif %};
          --label-badge-text-color: {% if is_state('binary_sensor.garage', 'on') %} red {% else %} green {%endif %};
          animation: {% if is_state('binary_sensor.garage', 'on') %} blinker 2s linear infinite {%endif %};
          }

It takes a long time to find “good” posts, but the result is impressive.
Thanks all…

7 Likes