Problem with my automation (Door Lock)

Hello everyone

I have a problem with my automation. At the moment it looks like this:

If the door sensor changes to ‘Closed’, then wait 1 minute and close ‘Door lock’.

Now to the problem. If the door is opened again within this minute, the door closes even if it is still open. How can I prevent this?

Thank you for your help.

Instead of using a delay in the actions of the automation add a duration to the trigger so that the automation triggers when door has remained closed for 1 minute.

Mmmmh. Why complicated when it can be easy.

Thank you