Garage Arrival Open issue

Okay I have setup a reed/contact switch on my garage door to indicate if the door is open or closed. What I am trying to do now is stop the door opening and closing straight away when both my wife and I arrive in the same car together. I have a separate rule for each of us arriving to open the door. How will I modify this rule to do this:
If Greg arrives and the door opens for Greg, then don't trigger the Felicity rule and visa versa. I checked the rules today when this did happen and it shows both rules triggered at the exact same time.

Why don't you combine the two into a single rule?

Trigger:

Greg arrives
OR
Felicity arrives

Actions:

IF Private Boolean False: Exit Rule
IF (Time between 7:40 and 23:59 AND Garage Door closed) THEN
    Set Private Boolean False
    on() on Garage open/closed
    Notify whatever
    Set Private Boolean True --> delayed 0:10:00 
END-IF 

Set the delay short/long enough so that both phones will not trigger it at the same time. But it will be triggered if there is a gap of time between your individual arrivals.

Just a thought.

Two thoughts to this.

  1. I donā€™t like using the private Boolean because I am not aware that it is visible anywhere to see the current state. So I prefer to create local variables. But I could be wrong on this.

  2. If a global variable is used, he can still keep the two rule separate if he prefers to do so.

Pertinent to your post, there is one relevant difference between PBs and LVs. While LVs are only available within a rule, the PB state for one rule can set from another rule (a useful trick). In this particular case, I see no need for two separate arrival rules, unless there is some other condition that wasn't described by @greglsh.

1 Like

Yes I was aware that a PB can be set from another rule. Just saying that I avoid them because I canā€™t see their current state anywhere?? Therefore I default to GVs if I need this functionality. Just my preference.

Re: 1/2 rules. I do agree with you in this case. Just recently I combined my lights on arrival and my lights when departing rules because I came to the conclusion that I was creating more complexity in this case. Just saying that sometimes itā€™s easier to think in separate boxes. :slight_smile:

1 Like

I used to have my garage opening rule setup as one rule so that if "any arrive" then open the door.
It always worked fine.
But for security in case the hub messed up and randomly set a device to departed then suddenly back to arrived in the middle of the night.
I programed an Xbee3 pro device as a prescence sensor and plugged it into a usb port in my car so it is only powered on and present when the car is running and in range.
Then goes departed when out of range or the car is turned off (modifying a SmartThings prescence sensor with a USB plug will also work but less range).

I have found this to be more secure as the hub never shows the device as present if powered off.

Hi @aayar

Thanks for the assistance, please can I ask you what the Private Boolean part of the rule actually does as I have no idea what this does in the rule you have shown. Also why is the word BOOLEAN in green is this meant to have some sort of value? Alos when I select "set Private Boolean" it asks for which part of the rule or the first option is This Rule , what do I select?

Thanks again

The PB has a binary value: True or False. In the example give, the complete rule executes ONLY if the value is True.

To prevent multiple iterations of the rule running (by detecting both your presence and your wife's presence), the value is set to False as soon as either of your presence is detected. If the next person's presence is detected a minute later, the rule is exited because the PB is false.

After 10 minutes, the PB is set to True again, so any new arrivals (after 10 minutes) will execute the rule.

Its in green because that's how Discord formatted it .....

@aaiyar
Thanks for the explanation, that is much clearer now. Sorry I edited my question while you were responding, when I select "set Priavte Boolean" it asks me for which part of the rule, what do I select for this, I chose this Rule is that correct?

Thanks again for the help.

Yup.

could you not just put a delay (5 seconds?) which would be over written or cancelled by the second arrival?

@aaiyar

Please could I ask you to have a look at this rule, I am not sure if I have done something wrong, but the garage door did not open at all when I arrived.

This is the Log of the arrival

At the end of each line it says skipped, so is the Private Boolean wrong?

1 Like

Your PB is currently false, so when your rule runs, it does the first check and exits the rule without setting the PB true. Once you enter this state, you don't have a way to get out of it because in order to set your PB to true again, it has to be true in the first place. You need a way to set it true.

1 Like

Couple things.

  1. As indicated by @andrewL - you need to set the PB for this rule to be True again. You can do that using another rule, which doesn't need a trigger and has a single action. The action being to set the PB true for your garage door rule.

  2. Use a simple conditional for "IF (Private Boolean is false): Exit Rule". Notice what you have is different that what I suggested above.

Once that correction is made, and your reset the PB, the rule will work fine.

@aaiyar and @andrewL

I am so terrible at this rule machine logic :crazy_face: I created a virtual switch, then created this rule below to try and change the Private Boolean to True. I click the switch but I don't think it is doing anything??

If this rule runs, it should set the PB as True for your other rule.

Open the other rule and see if the PB is true. Also, you need to edit the other rule to fix the error I pointed out before setting the PB to be true.

I managed to change the first part of the rule to a basic condition. I ran the PB rule, then I went into the garage rule and it still shows False next to the rule.

Please post your new rule

Hi here is the current rule

Looks perfect. It is telling you that the Private boolean is true. Look at it carefully.

It says:

IF (Private Boolean false FALSE) Exit Rule

That means it is FALSE that the "PB is false", i.e. the PB is true. Therefore, the rule is ready to run if triggered.