Hallo Community,
ich habe die Hoffnung, dass mir hier jemand weiterhelfen kann. Ich nutze eine Tile Karte, um mein Garagentor zu steuern und habe nun versucht, sie etwas “hübscher” zu gestalten mit Hilfe von card_mod.
Bei der Farbe ist mir dies auch gelungen, so dass sich die Anzeige rot färbt, wenn das Tor offen ist und ansonsten grün.
Nun möchte ich auch noch erreichen, dass sich das Icon ändert. Wenn das Garagentor offen steht, dann soll das Icon dies auch dementsprechend anzeigen.
Leider ist mir dies bisher nicht gelungen, obwohl ich mir Beispiele aus dem Netz gezogen hatte.
Kann jemand von euch vielleicht meinen Code so ergänzen, dass das Icon auf das offene Garagentor wechselt, wenn es offen ist? Das wäre wirklich toll. Vielen Dank schon im Voraus.
type: tile
entity: cover.garage_door
icon_tap_action:
confirmation:
text: ❗Soll das Garagentor wirklich gefahren werden❓
action: toggle
tap_action:
action: none
color: red
state_content: state
icon: mdi:garage
features_position: bottom
vertical: false
name: Garagentor
card_mod:
style:
mushroom-shape-icon$: |
.shape {
{% set state = states('cover.garage_door') %}
{% if state == ('closed') %}
--shape-color: rgba(0,128,0, .2) !important;
(% else %)
--shape-color: rgba(255,0,0, .2) !important;
{% endif %}
}
.: |
ha-state-icon {
{% set state = states('cover.garage_door') %}
{% if state == ('closed') %}
color: var(--green-color) ;
(% else %)
color: var(--red-color) ;
{% endif %}
}