You can exploit the behavior of the "built-in" %device% variable here. Normally, this refers to the name of the triggering device. "Wait for event" will set this variable to "timeout" if the wait ended because of the timeout rather than the actual event (or to the device name in the other case), so after your Wait for Event (with timeout), you could do something like:
Set myLocalVariable to %device%
IF (Variable myLocalVariable = "timeout") THEN
Close door
ELSE
(do things here if button pressed, or just leave it out?)
END-IF
You'll need to create a local string variable in this rule (or use a hub variable if you really want), since you can't directly access %device% in the way you'd need to without this workaround.
I also don't think that, with this, you'd need the local variable you suggested originally.
Something you didn't mention but is still a concern: your very first action of "Wait X minutes" will not be cancelled if the door closes--so the next actions will continue after that time regardless. What you probably want is:
Wait for condition: garage door closed --> duration X minutes
Note the use of "duration" on this wait (not to be confused with "timeout"). This will only continue if the door stays closed for that long, which is probably what you want.
This, in general, is not necessarily a good goal...but in this case, it probably doesn't matter either way. ![]()