I have a number of sensors in my rooms, and room cards that I’ve created with a chips on for lighting, fans, etc. I wanted to create a chip which changed based on the motion sensors in the rooms but I’m struggling.
card:
type: custom:mushroom-chips-card
chips:
- type: template
icon: mdi:motion-sensor
entity: binary_sensor.kitchen_sensor_motion
card_mod:
style: |
ha-card {
{% if is_state('binary_sensor.kitchen_sensor_motion', 'off') %}
--card-mod-icon-color: rgba(221, 235, 157, 0.5);
--card-mod-icon: mdi:motion-sensor-off;
{% elif is_state('binary_sensor.kitchen_sensor_motion', 'on') %}
--card-mod-icon-color: rgba(221, 235, 157, 0.8);
--card-mod-icon: mdi:motion-sensor;
{% endif %}
padding: 5px!important;
border-radius: 100px!important;
}
Right now, it changes the icon and that works perfectly - but changes the color of the icon, rather than the background of the chip - have I missed the code here to change this?
2 posts - 1 participant