First of all, from a safety perspective this sounds like a bad idea. There can be some scenarios where being able to “cancel” your previous button press would be important from a safety perspective.
This sounds like a job for Proxy Items:
Create a Proxy Switch which is what you send commands to and put on your sitemap. However, this Item is not bound to anything. Sending commands to this switch triggers a rule.
The rule will check to see if at least 30 seconds have passed since the last time it was sent a command and if so it will send the command to the “real” Switch which is connected to the opener.
import org.joda.time.*
val DateTime lastPressed = null
rule "garage proxy"
when
Item GarageProxy received command
then
// If you have persistence
if(GarageProxy.lastUpdate.after(now.minusSeconds(30).toDate)) Garage.sendCommand(ON)
// If not you need the import and val above
if(lastPressed.isAfter(now.minusSeconds(30)){
lastPressed = now
Garage.sendCommand(ON)
}
end