Disable door lock when door is open

Hello everyone,

Is there a way I can prevent a door from locking when the door is open? I have a door with a Z-Wave lock, and an Abode (Z-Wave) door sensor. I want to prevent the door lock from locking when the door is open. I know I can use conditional configurations in Lovelace, but I’m hoping for something lower level, and / or something that works with Homekit.

Maybe there’s a way to intercept the “lock” command and add conditions to it? Maybe I could create a custom lock entity that only works conditionally?

The only other solution I can think of is to automatically unlock the door when it is open if someone tries to lock it with a slight delay to prevent issues with status update latency.