Help with button card and lock symbol - electronic door lock

Hello there,

I was wondering if anybody knew how to do this… I have the Verisure integration, which also can controll an electronic lock on the front door (yale doorman). When I use a button card with this entity, the lock symbol changes color to red if the door is open and green if it is locked. The question is if it is possible to also change the lock symbol when the lock is open/closed. I was thinking mdi:lock-open and the color red when it is unlocked and mdi:lock and the color green when it is locked.

Is this possible with a litle yaml configuration?

Install custom button card via HACS front-end and as the custom repository (GitHub - custom-cards/button-card: ❇️ Lovelace button-card for home assistant) then you can set up the custom button similar to what I did for my garage door. Colours used here are red and green, so you only need to change the icons and the switch for your front door lock entity.
The other advantage of using the custom button card is that you have a lock feature…to open or close you must double tap the button on your UI so it prevents accidental activation when just sweeping through your dashboard.

type: custom:button-card
name: Garage Door Open
entity: switch.garage_door_opener_1
icon: mdi:garage-open-variant
color: rgb(255, 0, 0)
state:
  - value: 'off'
    name: Garage Door Closed
    icon: mdi:garage-variant
    color: rgb(0, 200, 0)
lock:
  enabled: true
  color: black

Thank you very much. The icon doesnt change when I unlock/lock the door. What am I doing wrong here? Thank you very much for your help!

type: custom:button-card
name: Dør åpen
entity: binary_sensor.inngangsdor
icon: mdi:lock-open
color: red
state:

  • value: ‘off’
    name: Dør låst
    icon: mdi:lock
    color: green
    lock:
    enabled: true
    color: green

Disregard the last post. It was the wrong etnity! Thanks a million for your help!

1 Like

Ugh… Its not working… @angusc Could you have a look? Do you see anything wrong here?

Hi Seb,

I’m not familiar with door locks as I don’t have any. First try substituting your “lock.inngangsdor” with another “switch.entity” that you have and see if the code and button is working like that.

Also when you post your choice, please use the “<>” code function from the header as it makes it easier for others to copy but also shows the indentation if your code more clearly.

Hi @angusc , sure, I want to comply :slight_smile:

Du you mean that i copy the code and put in between “<>” code function?

It is the <lock.inngangsdor> that isnt working. Its strange, because the entity is used in the standard Verisue Lock card. The button card is working fine with a different entity.

When you are writing a post and want to share some code, lol at the top of the post editor and use the code brackets “<>” (it won’t let me as the “/” ) but it’s below in the photo:

Regarding your lock, you can search all related entities by going to your system/devices and services, then look for the lock integration and tap on the “device”. Or you can search in the developer tools and states, then search the integration name. You might find the lock “switch” entity that you need for the button to work.