Hallo,
ich habe in einer Karte eine Bestätigung (confirmation) eingebaut, die beim “Verhalten bei Antippen” (tap_action) ausgelöst wird.
https://www.home-assistant.io/dashboards/actions/#options-for-confirmation
Das funktioniert auch soweit.
Um die Karte variabler zu gestalten, wollte ich bei der confirmation eine if-Bedingung für die Textanzeige einbauen.
Das funktioniert aber mit meiner getesteten Syntax nicht.
Frage:
Ist eine if-Bedingung bei der Textanzeige nicht möglich?
Oder ist meine Syntax falsch?
Diese confirmation funktioniert NICHT:
confirmation:
text: |
{% if is_state(entity, 'off') %}
Öffnen?
{% else %}
Schließen?
{% endif %}
title: Garage
confirm_text: Ja
dismiss_text: Nein
Diese confirmation funktioniert NICHT:
confirmation: |
{% if is_state(entity, 'off') %}
text: Öffnen?
title: Garage
confirm_text: Ja
dismiss_text: Nein
{% else %}
text: Schließen?
title: Garage
confirm_text: Ja
dismiss_text: Nein
{% endif %}
Komplette Karte mit confirmation:
(confirmation funktioniert NICHT)
type: custom:mushroom-template-card
entity: binary_sensor.status_garage_matthias_invertiert
primary: Garage Matthias
secondary: |
{% if is_state(entity, 'off') %}
Geschlossen
{% else %}
Geöffnet
{% endif %}
icon: |
{% if is_state(entity, 'off') %}
mdi:garage
{% else %}
mdi:garage-open
{% endif %}
color: |
{% if is_state(entity, 'off') %}
green
{% else %}
red
{% endif %}
tap_action:
action: perform-action
confirmation:
text: |
{% if is_state(entity, 'off') %}
Öffnen?
{% else %}
Schließen?
{% endif %}
title: Garage
confirm_text: Ja
dismiss_text: Nein
perform_action: switch.turn_on
target:
entity_id: switch.garage_matthias_shelly1
features_position: bottom
Komplette Karte ohne confirmation:
type: custom:mushroom-template-card
entity: binary_sensor.status_garage_matthias_invertiert
primary: Garage Matthias
secondary: |
{% if is_state(entity, 'off') %}
Geschlossen
{% else %}
Geöffnet
{% endif %}
icon: |
{% if is_state(entity, 'off') %}
mdi:garage
{% else %}
mdi:garage-open
{% endif %}
color: |
{% if is_state(entity, 'off') %}
green
{% else %}
red
{% endif %}
tap_action:
action: perform-action
perform_action: switch.turn_on
target:
entity_id: switch.garage_matthias_shelly1
features_position: bottom