False Alarm triggers / Rule checking

In smartthings (WebCore for Smartthings) has the ability to check to see if the event was triggered in the last x minutes. For example: person presence to trigger a garage door open/close could be false. As a person is quickly moving in and then out of a zone/location. I know how to do this under Smartthings to say if this was triggered in the last 2 minutes, ignore the trigger. Only if the last trigger event was greater than 2 minutes. I do use an application in Smartthings to accomplish this without building a rule (ridiculous automated Garage Door). This does do more than what I need. However, I know this can be done with rules. I have done this with other functions but not RM. Any advice how to accomplish this?

I'd probably use private boolean. Something like this... (making this up as I go along so no promises, but hopefully you get the idea):

Trigger:
  Whatever the trigger even is...

Actions:
  IF private boolean is true THEN
    Do whatever you need it to do here
    Set private boolean false
    Set private boolean true delayed: 0:02:00
  END-IF

Thank you! I will look at this.

How does it check for the last event?
Here is what I have.

It looks like you're using a simple IF statement. You need to use the IF-THEN type of construction.

You need one statement to set Private Boolean to true, and a second statement to set it to false. The way you have your rule it will always be true. If you look at my first example, the actions are only performed if Private Boolean is true. If it is, then Private Boolean is set to false so the action will not be performed again. Then after 2 minutes Private Boolean is set to true again, allowing the action.

I think you're going to need nested IFs also in order to deal with both the garage door being open and delaying opening it again for 2 minutes.

It's a good idea to get in the habit of adding the END-IF to close out your IF-THEN statements.

Try something like:

Trigger:
  SM-G977U, Carrie, Joe any arrives

Actions:
  IF Garage Door Opener closed THEN
    IF Private Boolean True THEN
      Garage open: Garage Door Opener
      Set Private Boolean False
      Set Private Boolean True -> delayed: 0:02:00
    END-IF
  END-IF

There are other ways to do this, and I'm sure others will pop up with their suggestions.

Thanks. I need to try this. I think I did it right.

Thank you so much for your help.

Let us know if it worked!

I'd still recommend that you add the END-IFs to the end of your actions. Your rule will work as you wrote it because there aren't any actions following the IFs. But, if you wanted to add other actions outside of the check for a closed garage door, you need to specifically close the IFs or RM would get confused. As you start to create more complex rules, closing IFs, REPEATs, etc., is just a good habit to get into.

OK Let me do that. I didn't you can do that. Thanks. New to RM. Thanks.

I think I got it now.

image

Thanks again

1 Like

I did some test with V-presence and attempting to cause the condition. It one point PB was stuck on a false state. I couldn't seem to clear it. However, I'm not familiar with PB. Thank you again for your help.

I can get it to trigger in less than 2 minutes from the initial trigger.

I suggest you turn on logging for that rule and check the logs to see what's happening. I created the rule below for testing purposes, using switches as triggers instead of presence. Note that I have logging turned on. How I tested:

  • I turned Switch - test on. The light turned on.
  • I turned Switch - Test 2 on. Nothing happened. The logs showed that the actions were skipped because Private Boolean was True.
  • I turned both switches off. Nothing happened because there are no actions specified for the switches going off. I turned the light off also.
  • I waited until the log noted that the delay was over and Private Boolean was reset to False. Then I turned Switch - Test 2 on. The light was turned on.

So... it worked exactly as specified. Sorry I can't help further with this. But the logs will hopefully give you a place to start looking.

Thanks. I will do more testing. I did notice your last rule the use of PB is the opposite of what we were working with. Do I have it backwards? Thanks again.

It really doesn't matter which way you have it. The key is that having it one way allows the rule actions to run, while having it the other way stops them.

Ok I will do some more testing. Thanks.

From what I can tell this only delays the rule. This doesn't check to see if a trigger hasn't occurred in the last x amount of seconds or minutes. That's what I'm looking to accomplish. Is this possible with RM?

Thanks you help again.

I'm really confused about what you're asking for. What do you want to have happen if a trigger hasn't occurred in he last x time? What do you want to have happen if a trigger has occurred in the last x time?

In your OP you said:

That's what the sample I posted above basically does. If it's been triggered within the last 2 minutes, it can still be triggered but none of the actions will run until the 2 minute delay has passed. Once the two minutes are up, it has to be triggered again to have anything run.

If you want something other than this, I'm not understanding what it is. Maybe someone else can help.

Ok thanks may I need to combine the open and close function. Thank you again.