Misux
25. Mai 2025 um 07:16
1
HI! Ich versuche eine Custom Card anzupassen was ich einfach nicht hinbekomme wie ich es gerne hätte…
Diesen Button würde ich gerne folgendermaßen ampassen…
Es ist ein selectbutton welcher 3 Modes hat: ON, OFF und ATUO
Ich würde gern nem+ben dem auto einen Namen “MODE:” haben und da drunter den eigentlichen Status welcher aus einer anderen entität hervorgeht:
sensor.relay_no_4_poolpumpe_state
ALso. Quasi so:
Poolpumpe
MODE: auto, on, off
STATUS: AN
Kann mir bitte einer helfen?
type: custom:button-card
entity: select.relay_no_4_poolpumpe
show_state: true
name: Poolpumpe
size: 20%
icon: mdi:pump
state:
- value: "on"
styles:
icon:
- animation:
- rotating 2s linear infinite
- color: red
- value: auto
styles:
icon:
- animation:
- blink 2s linear infinite
- color: green
- value: "off"
styles:
icon:
- color: null
tap_action:
action: more-info
hold_action:
action: more-info
Füge diesen Block ein (light.flur natürlich durch deine zweite Entität ersetzen):
state_display: |
[[[ return 'Mode: ' + entity?.state; ]]]
show_label: true
label: |
[[[ return 'Status: ' + helpers.localize(states['light.flur']); ]]]
(ich habe hierfür meinen Szenen Select benutzt.)
Das Fragezeichen ist ein sog. optional chaining (?.) operator .
localize übersetzt den Status ins Deutsche, bitte Dokumentation vergleichen.
Misux
25. Mai 2025 um 18:58
3
Boah klasse!
Vielen Dank!
Lässt es sich auch so einrichten das das Icon wenn der STATUS “Ein” ist das sich das Icon dreht und wenn der STATUS “AUS” aber der MODE auto ist dann blinkt?
Soll sich das Icon auch dann weiterhin rotieren, wenn select.relay_no_4_poolpumpe auf on steht?
Misux
26. Mai 2025 um 17:34
5
Alter Finne! Sehe jetzt erst was ich im Tietel geschrieben habe… Kann man das ändern??
Also:
Ja, bei select.relay_… ON und bei switch.relay_… “EGAL” (weil dann ist es auf jeden fall manuell ON soll es rotieren (ROT).
Bei select.relay_… AUTO und switch.relay ON auch rotieren (Grün).
Bei select.relay_… AUTO und switch.relay OFF nur leuchten (Grün).
Bei select.relay_… OFF ist klar: Dann keine rotation und kein blinken (Schwarz).
Wäre das so machbar?
Vielen dank dafür das du dir die Mühe machst…
So sieht es jetzt aus:
type: custom:button-card
entity: select.relay_no_4_poolpumpe
show_state: true
name: Poolpumpe
size: 30%
icon: mdi:pump
state_display: |
[[[ return 'Mode: ' + entity?.state; ]]]
show_label: true
label: >
[[[ return 'Status: ' +
helpers.localize(states['switch.relay_no_4_poolpumpe']); ]]]
state:
- value: "on"
styles:
icon:
- animation:
- rotating 2s linear infinite
- color: red
- value: auto
styles:
icon:
- animation:
- blink 2s linear infinite
- color: green
- value: "off"
styles:
icon:
- color: null
tap_action:
action: more-info
hold_action:
action: more-info
Ja, der Titel klingt ein bisschen… angemappst.
Probier’s aus:
type: custom:button-card
entity: select.relay_no_4_poolpumpe
variables:
switch: "[[[ return states['switch.relay_no_4_poolpumpe']; ]]]"
show_state: true
name: Poolpumpe
size: 20%
icon: mdi:pump
state_display: |
[[[ return 'Mode: ' + entity?.state; ]]]
show_label: true
label: |
[[[ return 'Status: ' + helpers.localize(variables.switch); ]]]
state:
- value: "on"
styles:
icon:
- animation:
- rotating 2s linear infinite
- color: red
- operator: template
value: |
[[[ return entity?.state === 'auto' && variables.switch.state === 'on';
]]]
styles:
icon:
- animation:
- rotating 2s linear infinite
- color: green
- operator: template
value: |
[[[ return entity?.state === 'auto' && variables.switch.state === 'off';
]]]
styles:
icon:
- animation:
- blink 2s linear infinite
- color: green
styles:
card:
- color: black
icon:
- color: black
tap_action:
action: more-info
hold_action:
action: more-info
1 „Gefällt mir“
Misux
26. Mai 2025 um 18:40
7
Klasse! Genauso Vielen DANK!