Check for status before Triggering Command

Let the rule trigger and then make the logic have a look here for a simple setup.

when
     Item OpenGarageCommand changed from OFF to ON
then
    if(   GarageDoorSensor.state == OFF ){ 
      // I expect the sensor to be ON when the door ist closed 
      DoSomeCommand
     }else{
     // Do nothing or state it was already closed.
     }
End

I hope I have understand the problem and this helps.