While I can create a binary sensor with the template I can’t control the lock with it.
It would be nice if icon_template was was supported on lock templates so when a door was locked it would show the lock, when unlocked however it would show the door open/closed state (if it is locked closed is already implied). That way I can control the lock and see the door state from one widget.
This might also be useful for smart locks that have error codes/additional sensors or other complex states to show an alternative state. Like if they are jammed, low battery or have other functionality.