Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Send Alert if Gate is left open
#1
I am trying to write a response to check if an automatic gate has been left open for more than an hour.  I would like Comfort to send an SMS alert (or email) to alert that the gate has been left open (I could also have it close the gate instead...but at this point I just want to raise a notification).

I have written the following response to open the gate:

If Input Gate = 0 Then  
  Open Door 2 1 10 
  Set Counter001(1) = 0 
  Do GateOpenCheck
End If


It calls the GateOpenCheck response:

If Counter Counter001 > 60 Then 
  Send SMS PhoneNo01 1 ! Send an alert that the gate is open
  Set Counter001(1) = 0
  Do GateOpenCheck
Else
  Increment Counter001(1)
  If Input Gate <> 0 Then
     Do GateOpenCheck After 60 Seconds Using Timer01(1)
  End If
End If


This is a recursive response which I believe is okay.  Just wanted to make sure this will work as expected--i.e., every hour that the gate is left opened it will send an alert.
Reply
#2
The gate open check response is going to increment the counter every minute until it reaches 60 minutes so that part seems correct. it does not cause an endless loop.

However if you close the gate, that does not stop the counter from counting up. You need to add a response to stop the timer 1 in Input  Gate off response
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)