Announcement

Collapse
No announcement yet.

Best way to find out which zone triggered an alarm?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    I wrote a fairly simple plugin to go through my DSC zones and give some text summaries for use in HSTouch. If you're any good at hacking through a plugin in visual studio you may be able to adapt this or rip out some code to what you want.

    I have four devices (created by the plugin) that summarise my zones. Each has an on and off button that I use to decide if it will send me an alert based on change or not (that bit is done by standard events). If the auto button is on then events will turn the other zones on and off. If a zone is on and it changes, I use the pushover plugin to send me an alert to my phone.
    Attached Files

    Comment


      #17
      So I've been using this script for a while now and while it's functional, I want it to identify the single zone that was JUST opened instead of the others that are already opened. I know that the script is looking through all zones and finding the open ones. Anyone know how I can do this with a single event/script?

      Comment


        #18
        Originally posted by Sireone View Post
        So I've been using this script for a while now and while it's functional, I want it to identify the single zone that was JUST opened instead of the others that are already opened. I know that the script is looking through all zones and finding the open ones. Anyone know how I can do this with a single event/script?
        Got it! Seems like I just needed to add the DeviceTime function and only take action on which zone has been opened for less than a minute. Here's the updated code for anyone interested.

        Code:
        Sub Main(parms As Object)
        	
        	Dim zonerefs() As Integer = {124,125,126,127,128}
        	Const DeviceNamePrefix As String = "Security EnvisaLink"
        		
        	For each zoneref As Integer in zonerefs
        	If ((hs.devicevalue(zoneref) = "1") and (hs.DeviceTime(zoneref) < "1")) then
        		hs.CreateVar("zoneopened") 
        		hs.SaveVar("zoneopened",hs.devicename(zoneref).Replace(DeviceNamePrefix, String.Empty))
        		hs.Speak("The $$GLOBALVAR:zoneopened: was just opened")
        	End if
        	Next
        	 
        End Sub

        Comment

        Working...
        X