Hello everyone,
I’m trying to add a blinking red icon to a picture-elements
card that only appears when an entity is on
. I’m using a conditional
element for this.
I’ve tried a few different card_mod
approaches, but none of them seem to apply the color or animation to the state-icon
element. The icon itself shows up correctly, but the styling doesn’t take.
Here is the code I’m currently using:
type: picture-elements
image: /local/your_image.png
elements:
- type: conditional
conditions:
- condition: state
entity: binary_sensor.anti_legionella_active
state: "on"
elements:
- entity: binary_sensor.anti_legionella_active
title: Anti-legionella running
type: state-icon
style:
font-size: 100%
left: 75%
top: 83%
card_mod:
style:
ha-state-icon:
$:
ha-icon:
$: |
ha-svg-icon {
color: #f44336;
animation: blink 1s linear infinite;
}
@keyframes blink {
0%, 50%, 100% { opacity: 1; }
25%, 75% { opacity: 0; }
}