The firmware, could be ESPEasy or Tasmota, just drives the servo.
You will need to create a rule with a timer to command the openHAB MQTT item to send whatever you want …
You may use something like createTimer(now.plusMillis(XX)
Driving the servos is the easy part, the trickiest part is knowing when to stop the servos. What you posted will work, like driving it for 2 seconds, etc.
What if you want to know for sure when to stop it? For example, for how long will you drive the servo, if you don’t know the bolt state/position?. What I have done in the past is use an accelerometer to determine the angle of the deadbolt. I used an LIS3DH, same accelerometer used in an August lock. They are tiny though but controllable via i2c.
Using an accelerometer or any angle sensor will also give you locked/unlocked states