Garage Door Opening Rule

Please can someone help. I am trying to setup a RM4 rule to open my garage door when either my wife or I arrive home using presence. I have it working okay, but when we are both in the same car the garage door opens, then tries to close when it activates the second persons "arrival" part of the rule.

Something like this:

Trigger: When user A or User B arrives
Action: If the time is between 7:30am and 22:30, open garage, If both User A and User B arrive within 2 min of each other, only run the open action once. If user A arrives on his own then open. If user B arrives on his own then open.

P.S we close the garage manually once are done. I use a Sonoff SV (like a pulse relay) to open and close the garage.

What driver are you using to run the sonoff sv?

The easiest solution would be to tie this in with the virtual garage door app to create a virtual garage door that you would control and then only send the open signal if the door is currently closed. Without that, you don't know what the current state of the door is. So, you won't be able to use that in the logic inside of the driver or the rule.

The easiest thing to do, would be to use a local boolean variable inside of your rule. So, first create the boolean variable. Your triggers look good.

If time is between x and y and variable is true  then
      Set variable to false
      Open garage door
      Delay actions by 2 minutes
      set variable to true

If you have a contact sensor on the door, this logic becomes a lot simper.

Hi Ryan780

I use @erocm123 Sonoff S20 driver. It basically pulses to contacts on the garage motor, one pulse opens it and then if you pulse it again it closes, so currently my rule, when both of us are in the car it pulses once for me, opens the garage, then while the garage is opening it pulses again for the wife and closes the door, which is not great.

I am busy adding a reed switch ( magnetic contact) which should indicate if open or closed. Sorry for ignorance, what do you mean by Boolean variable and where would "this" be setup?

Thanks for the quick reply

okay. well, the rule that i posted should solve that.