Lock sensor with transient 'locking/unlocking' state

I am trying to provide a better user experience on my front-end for a door lock button: right now, pressing the lock button will successfully lock/unlock the door, but it does take up to 5/10 seconds for the button state to update to the resulting state.

The result is that users get confused and tend to repeatedly press the button and get frustrated. A better user experience would be to have the button immediately update its state to “Unlocking” or “Locking” waiting for the lock to confirm its new state, potentially with a timeout in case the action was not successful for some reason.

So far, I haven’t been able to find an elegant solution for doing this, and before I dive into implementing something complicated to solve this issue, I though I would first ask the community if anyone is aware of someone who has done this before? One avenue might be to extend HA with a python script to add a service to set entity state/attributes, then write a script where I manually update the entity state after sending the “lock”/“unlock” command, but that does require a custom python script as far as I can tell?

Thanks!

1 Like

You could use the confirmation function for a hint like „Door will be locked/unlocked“. More can be said if you want to share your button code and the data of your lock entity.