This is my card:
type: custom:auto-entities
filter:
include:
- domain: sensor
area: Abfall
card:
type: entities
title: Müllentsorgung
state_color: false
style: |
:host {
--paper-item-icon-color:
{%- if state.attributes['Upcoming'].type == 'Biotonne' %}#brown
{%- elif state.attributes['Upcoming'].type == 'Altpapier' %}blue
{%- else %}black
{%- endif %};
}
sort:
method: attribute
attribute: daysTo
numeric: true
view_layout:
column: 1
Each entity used has a attribute “Upcoming” with a type. How can I use that for styling:
I found the solution:
type: custom:auto-entities
filter:
include:
- domain: sensor
area: Abfall
options:
style: |
:host {
--paper-item-icon-color:
{% if 'Biotonne' in state_attr(config.entity, 'types') %}
#724933
{% elif 'Altpapier' in state_attr(config.entity, 'types') %}
royalblue
{% elif 'Gelbe Tonne' in state_attr(config.entity, 'types') %}
#f0ca00
{% elif 'Gartenabfälle' in state_attr(config.entity, 'types') %}
green
{% elif 'Hausmüll' in state_attr(config.entity, 'types') %}
black
{% elif 'Schadstoffmobil' in state_attr(config.entity, 'types') %}
#CC5500
{% else %}
inherit
{% endif %};
}
card:
type: entities
title: Müllentsorgung
state_color: false
sort:
method: attribute
attribute: daysTo
numeric: true
view_layout:
column: 1