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.
Last edited on Sunday Jan 19th, 2025 01:16 pm by darnold
|