Rotating door automation

I suppose another way to do it would be 2 buttons, one to set the open value, one to set the closed value.

Press and hold to enter the subroutine ( maybe with an LED to show it was active) and press agin to save the setting.

What would the code for something like that look like?