Not sure what to do here.
The error message replaces the ‘.’ between “lock.unlock” with a slash.
double_tap_action:
action: call-service
service: |-
{% if is_state('lock.front_door_lock','locked') %}
lock.unlock
{% else %}
lock.lock
{% endif %}
target:
device_id: 192b5263584bbe96bb3a26246f796922
data: {}
tom_l
June 17, 2023, 1:41am
2
You can’t use templates in dashboard cards. Put your action in a script (that does support templates) and call that from the double tap action. Scripts are services.
tom_l
June 17, 2023, 1:49am
3
Also use the entity id instead of the device id in your script. It will save you pain in future.
double_tap_action:
action: call-service
service: script.toggle_lock
script:
toggle_lock:
- sequence:
- service: >
{% if is_state('lock.front_door_lock','locked') %}
lock.unlock
{% else %}
lock.lock
{% endif %}
target:
entity_id: lock.your_lock_here
Even if it is a template card?
type: custom:mushroom-template-card
primary: Front Door
secondary: >-
{% if is_state('lock.front_door_lock', 'locked') and
is_state('binary_sensor.front_door_contact_contact','off')%}
Locked
{% elif is_state('lock.front_door_lock','locked') and
is_state('binary_sensor.front_door_contact_contact','on')%}
UnLocked-Open
{% elif is_state('lock.front_door_lock','unlocked') %}
Unlocked
{% endif %}
icon: |-
{% if is_state('lock.front_door_lock', "locked") %}
mdi:lock
{% else %}
mdi:lock-open-alert
{% endif %}
layout: vertical
fill_container: true
icon_color: |-
{% if is_state('binary_sensor.front_door_contact_contact', "off") %}
green
{% else %}
red
{% endif %}
tap_action:
action: more-info
hold_action:
action: none
entity: camera.front_door_medium
double_tap_action:
action: call-service
service: |-
{% if is_state('lock.front_door_lock','locked') %}
lock.unlock
{% else %}
lock.lock
{% endif %}
target:
device_id: 192b5263584bbe96bb3a26246f796922
data: {}
card_mod:
style: |
ha-card {
{% if is_state('lock.front_door_lock', 'locked') and is_state('binary_sensor.front_door_contact_contact','off') %}
background-color: #023702
{% else %}
background-color: #370202
{% endif %}
}
tom_l
June 18, 2023, 2:29am
5