Once per second the software will read from each of the distance sensors. The sensor reading returns the measured distance in centimeters. If the distance is within a certain window of values ( 10 to 30cm in my case) the door is under the sensor. Anything else is considered as the door being missing. To prevent false readings, the sensor is checked multiple times before any action is taken.
Once the software is sure that the door is open, a timer is started. For my setup the timer starts counting down for 10 minutes. After 10 minutes if the door is still open, a signal is sent to the garage door opener which causes it to close the door. Each time the pushbutton gets pressed 10 minutes will be added to the countdown, so you can leave the door open longer if you need to.
Time remaining is displayed with a neopixel-style LED bar using the FastLED library. Since the default time is 10 minutes, each segment on my LED strip is worth 10 minutes. If less than 10 minutes remain, the segment will dim accordingly.
The software is designed to work without interfering. If you close the door yourself, the software will understand and stop the timer. Because of this, the software won't accidentally open the door once it's closed