Moin, über Card-Mod kannst du die Icon-Color und State-Color vom Text verändern. Anbei ein Beispiel. Damit solltest du dann die Farbe entsprechend deinen Wünschen setzen können.
Hi, die Frage habe ich dir doch eigentlich schon beantwortet. Schaue mal im Code im ersten Beispiel, das Template kannst du so natürlich auch auf das icon im Zusammenspiel mit anderen Sensoren verwenden, müsste dann so funktionieren:
type: vertical-stack
cards:
- show_name: true
show_icon: true
type: button
entity: binary_sensor.node_ws_pve01_status
show_state: true
icon: mdi:server
name: WS-PVE01
tap_action:
action: navigate
navigation_path: /dashboard-tablet/ws-pve01
card_mod:
style: |
ha-card {
--state-color: {% if is_state('binary_sensor.ws_nas_ping', 'off') %} red {% else %} green {% endif %};
}
.state {
color: {% if is_state('binary_sensor.ws_nas_ping', 'off') %} red {% else %} green {% endif %} !important;
}
grid_options:
columns: 6
rows: auto
Ah ok, dann muss man das über eine Sensorabfrage im Template machen, dann kannst du den anderen Sensor abfragen und beliebig einfärben. Habe dir jetzt alle drei Werte gesetzt für Icon, Name und Secondary. Ich gehe davon aus, dass dein Sensor on/off liefert. Wenn nicht, muss das im Template neben der Farbe auch anpassen.
type: vertical-stack
cards:
- type: button
name: WS-PVE01
entity: binary_sensor.23124ra7eo_android_auto
show_name: true
show_icon: true
show_state: true
icon: mdi:server
tap_action:
action: navigate
navigation_path: /dashboard-tablet/ws-pve01
card_mod:
style: |
ha-card {
--state-icon-color: {% if is_state('binary_sensor.agip_eni_langenwahler_str_19_status', 'on') %} green {% else %} red {% endif %};
color: {% if is_state('binary_sensor.agip_eni_langenwahler_str_19_status', 'on') %} orange {% else %} red {% endif %};
}
.state {
color: {% if is_state('binary_sensor.agip_eni_langenwahler_str_19_status', 'on') %} blue {% else %} red {% endif %} !important;
}
grid_options:
columns: 6
rows: auto