I’m looking for a way to add a class (“is_active”) to a card if the entity state is on. I’ve managed to create conditional styles using jinja and card_mod, but using the same syntax to print a class-name I’ve failed to to do - probably because my non-existing jinja-skills. Is this possible?
type: horizontal-stack
cards:
- type: custom:mushroom-entity-card
layout: vertical
entity: binary_sensor.leak_sensors
icon: mdi:water-off-outline
name: Leak sensors
card_mod:
class: {% if states('binary_sensor.leak_sensors'), 'on'} is_active {% else %} {% endif %}
[...]