Hi David, check this (replace red & cyan with your colors):
type: entities
entities:
- type: custom:auto-entities
card:
type: custom:fold-entity-row
padding: 0
head:
type: section
label: Fritz!Box Switches and Sensors
open: false
filter:
include:
- entity_id: sensor.cleargrass_1_*
- entity_id: switch.test_*
- entity_id: binary_sensor.test_*
options:
card_mod:
style: |
:host {
--paper-item-icon-color:
{% if is_state(config.entity,'on') %}
red
{% else %}
cyan
{% endif %}
;
}
show_empty: true
sort:
method: name
P.S. Since your "binary_sensor"
is some ONE particular sensor, then you may specify it explicitly:
....
include:
- entity_id: sensor.cleargrass_1_*
- entity_id: switch.test_*
- entity_id: binary_sensor.iiyama_1_ping_availability_status
....
Also, if you need to have this connectivity sensor to be the last in the list, then move the "sort"
section to lower levels:
- entity_id: sensor.cleargrass_1_*
sort: &ref_sort
method: name
- entity_id: switch.test_*
sort: *ref_sort
- entity_id: binary_sensor.iiyama_1_ping_availability_status

Or even you may not use card-mod at all:
include:
- entity_id: sensor.cleargrass_1_*
sort: &ref_0
method: name
- entity_id: switch.test_*
sort: *ref_0
- entity_id: binary_sensor.iiyama_1_ping_availability_status
options:
state_color: true
