Hi guys,
I’m pretty much frustrated by a simple tasks that I just can’t solve.
all I want is a button that will lock if door lock is open and unlock when it’s closed.
I’ve tried the following syntax but no success:
card:
type: button
name: Door Lock
entity: lock.schlage_touchscreen_deadbolt_door_lock
show_state: true
state:
- value: "locked"
color: green
icon: mdi:lock
- value: "unlocked"
color: red
icon: mdi:lock-open-variant
tap_action:
action: >
{% if is_state('lock.schlage_touchscreen_deadbolt_door_lock', 'locked') %}
lock.unlock
{% else %}
lock.lock
{% endif %}
data:
entity_id: lock.schlage_touchscreen_deadbolt_door_lock
what am I missing here?
Thanks!