So my idea is ‘simple’.
I want an image to show the state of the lock, and pressing it changes the state.
So far I’ve gotten an image to show the state by using a picture glance.
It also shows they grey bar, despit I’ve set show_state: false
So how do I scale the image down, and get rid of the bottom grey bar?
But I guess the really tricky part is the actions, with a lock I don’t have a ‘toggle’ action, only a ‘lock’ and ‘unlock’.
So how do I call the right service based on the state of the lock?
Ok, so I think I figured out that I need to do a template for the ‘state sensitive’ service that is to be placed as a ‘tap_action’.
I’ve placed this in the ‘templates.yaml’:
I just added the lock to the appdaemon dashboard, and there it does exactly what I want it to, clearly shows if the lock is locked, and if I press it, it will toggle the lock.
This doesn’t seem to work anymore. I’m guessing the custom:button-card was updated and it broke the state-based actions? I copied/pasted your code above for the lock card, and whenever I tap, it pulls up the info on the lock, with the options to Lock or Unlock.
Could you tell me what version of the custom:button-card you’re running? I would be willing to downgrade to get this simple functionality.
Yes, it was updated on 0.108 as far as I remember.
I’ve moved it to a vertical stack, as I’ve added the videodoorbell video below the lock button, but that can be removed if you wish:
So I have two pictures that I use to display if it’s locked or not.
And depending on the state of the lock, I call an ‘unlock’ or ‘lock’ command.
So it just has one ‘tap action’ and the service call is magically changed upon the the state of the lock.
Just wondering if this last sample bit of code still works?
I am essentially trying to achieve the same thing but when I “tap” on the icon, i get an error that indicates that the lock.service is not found.
A variation of my situation from what’s shown above is that I’m using it on a binary_sensor entity for a door, and then i’m tapping on it to lock/unlock the door lock that’s associated with that door.
i’m assuming it’s because the “entity_id: entity” on the last line is what’s probably causing the issue because the main entity is a door and i’m calling for an action for a lock. I’ve tried replacing “entity” with the actual lock’s entity, “lock.garage_entry_lock” without success. I think the syntax of mine is still wrong … (duh) … can anyone help?
Not sure what you try to accomplish, it seems the config snippet is not complete.
I would suggest you build the config for the locking button ‘outside’ of the multiple-entity-row, make it work there, and then move it to the multiple-entity-row afterwards.
I have a danalock v3 btze, connected to aeotec. I use zigbee, but this lock is much older than the HA setup, so it was z-wave.
So first part of my config is that I show two different pictures if it’s locked or not.
Secondly the tap_action is for when you press the picture shown.
The service to call, depends on whether the entity used in the button-card has a state of locked or not, that is why it refers to ‘entity’ simply, that will take the entity from the button-card.
Apologies for not explaining it very well, but since a picture is worth a thousand words …
This is a custom card (multiple entity row) and the problem I encounter is that the “main” entity associated with it is a binary_sensor (a door), not a lock. What I’m trying to achieve is for the tap_action to (un)lock the locking device for the door. Since there is no “lock” service for the binary_sensor, it is throwing an error indicating that the lock.service is not available.
I need some guidance to redirect the “entity_id: entity” to not be directed to the main entity, but to the secondary entity.