Wall timer for automations

I would like to provide a convenient automation and push-button switch for bathroom users, which would automatically open a window when the user actuates it for a variable amount of time, and then when the time expires, the window closes. The window is opened with a remote SmartThings-integrated switch, and is closed with a different SmartThings-integrated switch.

I was thinking of having a smart rotary knob where the user can rotate it or a button where the user can press and hold it, and as the user holds it down or twists it, a counter increases the duration of time (aka, time the length of time the switch is in press-and-hold mode, or time the interval between press down and release). Then when the user lets go, it returns to its original position (off), and a number is generated, such as 1 minute for every second that the switch was held. Then a routine activates the first switch immediately, and activates the second switch after the calculated duration of time. An LCD screen could show the length of time remaining.

This seems to be kind of complicated to do with SmartThings. Can it be done, though?

Here is a simpler off-the-shelf alternative: connect an in-wall spring wound countdown timer (aka mechanical timer) to a smart contact sensor such as SONOFF ZBMINIR2, SONOFF MINIR4M, Shelly Wave i4, or Shelly Wave i4 DC. When the user twists the knob past the “Turn Past”, the circuit closes. This triggers a SmartThings automation to activate the window open switch. When the mechanical time winds down and finally gets to zero, the circuit opens. This triggers another SmartThings automation to activate the window close switch.

This seems both easier and more idiot-proof.

Thoughts?