RM Delay Function Operation When App with Delay is Triggered Multiple Times

This might be an HSM question, but I think that it is more RM related so I am posting here.

So … what I want to do is, after an HSM Intrusion, wait for 3-minutes, and then run some other code. I am currently using the RM DELAY function and it works sometimes, but not all the time. It appears that HSM is sending the Intrusion alerts every minute (which is OK) but this causes the APP to be retriggered every minute … and I think that is causing me a problem.

The question is, how do I code the app in RM to run the app code once and honor the delay at 3-minutes, and not have recurring triggered instances of the app/delay? I think that I understand basic coding techniques (we’ll see about that) … so what I am asking for is more of an understanding of the RM Delay functionality under these conditions.

My basic APP seems to be getting confused and intermittently runs shorter than 3-minutes (my guess is because Intrusion triggers arrive every minute).

Trigger Events – Any Intrusion
Actions
Delay HSMRearmDelay(0:03:00) (cancelable)
Do some other code

Is Delay the correct way to do this? Would I need to add a flag (TimerActive) for “first pass” and where? Would either of the following two examples work?

Seems like on the second pass would just execute the other code without any delay …

Trigger Events – Any Intrusion
Actions
TimerActive = True
If (TimerActive = False) Delay HSMRearmDelay(0:03:00) (cancelable)
Do some other code

This version seems like other code may never execute

Trigger Events – Any Intrusion
Actions
IF(TimerActive = False) THEN TimerActive = True
IF (TimerActive = False) THEN
Delay HSMRearmDelay(0:03:00) (cancelable)
Do some other code
TimerActive = False
ENDIF

  • Do the actions need to run after the 3 minute delay no matter what?
  • If the alarm is cleared before the 3 minutes is up, do you still want to run the code?

Thanks for the rapid response... I went off on vacation ... so my response is slower.

Nice catch .. As you deduced, the actions should cancel if HSM is disarmed. I am interested in learning the best way to do this. I've been giving this some more thought while on vacation ... What about this (splitting into two apps)?

APP Intrusion
Triggers
...Intrusion
...Intrusion Home
...Intrusion Away
Actions
...IntrusionDetected = True

App Other Code
Triggers
...IntrusionDetected = True
...Disarmed
Actions
...If Disarmed
......IntrusionDetected = False
......Stop Repeat
...Else
......Delay 3-mins
......Other code
...EndIF

I think you'd be set using something like:

Trigger: Intrusion
Actions:
Wait for event (Disarmed) timeout 3 min
IF(Disarmed)
     exit rule
ELSE
     Other stuff
END-IF

Ryan, Thanks again for your response ... I am back from my short vacation and looking at my Hubitat app now.

The code syntax you suggested is new to me ... so I am learning. At this time I think it is more expeditious to give you my requirement. It is pretty simple.

3-minutes after an intrusion, I want to automatically rearm HSM (shut off siren so as not to annoy my neighbors)
Except if HSM is disarmed during the 3-minutes and then I just want to stop the 3-minute rearm timer

Can you suggest a solution (if the above doesn't already do it ... if it does I will concentrate harder on understanding it)?

Sorry for the delay. My proposed rule should meet what you're trying to do. The "ELSE - other stuff" would be where you'd rearm.

Essentially we're saying:

Trigger: Intrusion
Actions:
"// Wait for either the system to disarm or three minutes to pass; whichever comes first."
Wait for event (Disarmed) timeout 3 min
"After three minutes or the system is disarmed; check if the system is disarmed. We need to check in case we get to this line because of the timeout"
IF(Disarmed)
"// If the system is disarmed, exit the rule"
     exit rule
ELSE
"// If the system is not disarmed, rearm the system or whatever else you may wish to do (e.g. release the kraken, etc.)"
     Other stuff
END-IF

Thanks again ... I'll study it some more ... and report back.

1 Like

Oh yeah ... that's the bomb! :bomb: It looks simple but it took me a while to understand it. Thanks. :clap:

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.