For those not into hacking I use a Shelly 1 to control the garage door and aqara ZigBee contact sensor, controlled by home assistant.
I have one in our postbox flap to detect when we get mail - the sonoff needed 2-3 seconds to detect anything being open (and thus would miss the event) - and the flap being closed by then made it harder to send out the signal. The aqara's are almost instant and send out while the flap is lifted.