Announcement

Collapse
No announcement yet.

Looking for logic ideas for alarm conditional on doors/windows state

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

    Looking for logic ideas for alarm conditional on doors/windows state

    I have an Abode security system for which I wrote a couple of python scripts to allow me to receive state changes for alarm and alarm sensors, and to send commands to the security system. I have a wall mounted ipad that I've configured with a popup keypad to arm/disarm, etc.

    I've got the whole rig working pretty well. What I want to do now is when I arm the alarm, if one of the alarm sensors is open (ie a window or door), I want to trigger a popup to warn me about it. The only thing is there's like a dozen sensors to deal with. So I'm trying to come up with some logic to do this without having to resort to having each event need a dozen conditions added to them. My arming events already have 4 pairs of "If this and that" or "If this and that" or ....etc. having to addall the alarm sensor virtual devices into the mix would make for a pretty onerous event.

    I suppose I could perhaps create a virtual device that trips on if any of the other devices are open. Though If I use that to trigger the popup, I also would like to find a way to have it list the devices that are open. ie. "The following devices are open: Living Room Window, Back Door." kind of idea. Not sure how to dynamically display that list.

    Ideas?

    regards,

    Paul

    #2
    I would handle this by using a script and 1 or 2 virtual devices. I would have an event run a script every time a sensor changes state. The script would check each sensor and then set a virtual device to either secured or unsecured. If unsecured the script would set a 2nd virtual device to a coma delimited list of all open sensors. You could substitute a global variable for this 2nd device. When you go to arm, and your virtual device is unsecured then you pop up the list of open sensors.
    HS4 Pro on Shuttle NC10U, Win10; Z-NET
    Number of Devices: 1005
    Number of Events: 293

    Plug-Ins: BLLock, DirecTv, EasyTrigger, Honeywell WiFi Thermostat, Marquis monoprice Amp, MeiHarmonyHub, PHLocation2, Pushover 3P, UltraM1G3, rnbWeather, Worx Landroid, Z-Wave

    External applications: Homebridge-homeseer, Geofency, EgiGeoZone.

    Comment


      #3
      This is copied from a post I made in July here. While the basis of the post was for speak events, I use the virtual devices in security arm/disarm events, heating events and others.

      I don't know if you are willing to use a simple script, but a script is the easiest way to populate a device with an array of all of the doors or windows are open. I use a script that Wayne (waynehead99) built and modified it for my use. I use several virtual devices and multiple subroutines in this script to update different groups. In this simplified script I have pared the script down to all windows and all doors. There is a virtual device for each. Lines in a script that begin with a single quote are only comments, they have nothing to do with the function of the script.



      When the script runs, it goes through one of two fixed arrays of reference numbers for the doors or windows I wish to check. It will populate each virtual device with the names of each window or door that is open. As you can see above, the front door is open and all windows are closed. This is a simplified version of the script:

      Code:
      'these are the virtual devices to be updated by the script
      '5281 Windows
      '8829 Doors
      
      'Use the reference ID of the door or window sensor devices in the arrays below
      
      dim array_windows() as string = {"4557", "4548", "4550", "4543", "4556", "4549", "4564", "4553", "4555", "4554", "4551", "4545", "4544","4559", "4560", "4561", "4562", "4563"}
      
      dim array_doors() as string = {"4565", "4542", "4558", "4566", "4532", "4531", "4552", "4523", "4522", "4528", "4527"}
      
      dim windows_count as integer = 0
      dim window_name as string = ""
      dim wstr as string = ""
      
      dim doors_count as integer = 0
      dim door_name as String = ""
      dim dstr as string = ""
      
      Dim dv as Object
      
      'Using 2 subs, one for doors and the other for windows
      
      'WINDOWS
      sub windows(ByVal Parms as Object)
      Try
      windows_count = 0
      window_name = ""
      wstr = ""
      for each devw as string in array_windows
      'hs.writelog("Array", "Window " & window_name & " | Value " & hs.DeviceValue(devw))
      if hs.DeviceValue(devw) = 1 then
      windows_count = windows_count + 1
      dv = hs.GetDeviceByRef(devw)
      window_name = dv.Name(hs)
      wstr = wstr & window_name & ",<br>"
      hs.writelog("DoorWindow", window_name & " Open")
      'hs.writelog("DoorWindow", array_windows)
      end if
      next
      If windows_count > 0 then
      hs.SetDeviceValueByRef(5281,100,true)
      hs.SetDeviceString(5281, wstr,true)
      Else
      hs.SetDeviceValueByRef(5281,0,true)
      hs.SetDeviceString(5281, "All Windows Closed",true)
      End If
      
      hs.writelog("DoorWindow", "Window Count: " & windows_count)
      
      Catch ex As Exception
      hs.WriteLog ("DoorWindow", "Error: " & ex.Message)
      End Try
      
      End Sub
      
      'DOORS
      sub doors(ByVal Parms as Object)
      Try
      doors_count = 0
      door_name = ""
      dstr = ""
      for each devd as string in array_doors
      'hs.writelog("Array", "Door " & door_name & " | Value " & hs.DeviceValue(devd))
      if hs.DeviceValue(devd) = 1 then
      dv = hs.GetDeviceByRef(devd)
      door_name = dv.Name(hs)
      doors_count = doors_count + 1
      dstr = dstr & door_name & ",<br>"
      hs.writelog("DoorWindow", door_name & " Open")
      end if
      next
      If doors_count > 0 then
      hs.SetDeviceValueByRef(8829,100,true)
      hs.SetDeviceString(8829, dstr,true)
      Else
      hs.SetDeviceValueByRef(8829,0,true)
      hs.SetDeviceString(8829, "All Doors Closed",true)
      End If
      
      hs.writelog("DoorWindow", "Door Count: " & doors_count)
      
      Catch ex As Exception
      hs.WriteLog ("DoorWindow", "Error: " & ex.Message)
      End Try
      
      End Sub
      I think the script is commented well enough.

      Just create your virtual devices for storing windows and doors. Then use the Reference ID of the virtual devices in the script. Build your arrays using the Reference IDs of the doors and windows you want to check. The script will set the virtual device to Off (0) when all devices are closed and at On (100) if any device is open. The actual text is written to the string for each device. You can then use the device string in a TTS announcement, email or other method of communicating while using the value as a trigger or condition.

      When we go to bed our "House to Sleep" events will run the script.





      If any doors or windows are open it will speak the string values of either or both devices to remind us that a door or window is open. I use a script to initiate my TTS since we use all Sonos devices for announcements. The script allows me to set the levels, voice and rooms where the announcement is made.



      The script is run any time a door or window is opened with these events. They are triggered by Easy Trigger group triggers. We can optionally have the system announce when any door or window is opened.



      I also run the script to check doors and windows on a schedule to make sure it is absolutely current.

      I also have broken the virtual devices into subgroups of doors and windows, so that I can separate the house from two outbuildings and a back porch.



      Hopefully this makes sense. If not, ask away
      Last edited by randy; October 22, 2018, 05:06 PM. Reason: image rendering problem
      HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

      Comment


        #4
        Thanks folks, those are all good suggestions and gives me something to work with. I've already got the virtual devices, the big thing was trying to avoid having about 50 conditions to round out the event. The above suggestions should help. Since I already have a script that listens for changes to the security sensors and updates the virtual devices in homeseer, it shouldn't be too hard to doctor it to also update a "something is open" virtual device as well taking from some of the above suggestions. Lots of food for thought here. Thanks!

        Paul

        Comment


          #5
          paul - I am now looking into the Abode system. After looking through all of the alarm systems out there I think this is the one I will go with. Currently have a Caddx system that is getting very long in the tooth. I will probably keep it for triggering events when doors open etc. as it is very quick and local. I would be interested in getting a hold of your scripts so I can try testing here. I have similar scripts to the ones you mention above set up for checking all of my door locks, presence sensors, etc. and would be more than happy to share as I build. Thanks.

          Comment


            #6
            Originally posted by simonmason View Post
            paul - I am now looking into the Abode system. After looking through all of the alarm systems out there I think this is the one I will go with. Currently have a Caddx system that is getting very long in the tooth. I will probably keep it for triggering events when doors open etc. as it is very quick and local. I would be interested in getting a hold of your scripts so I can try testing here. I have similar scripts to the ones you mention above set up for checking all of my door locks, presence sensors, etc. and would be more than happy to share as I build. Thanks.
            Sure thing - as mentioned in other thread, I'll bundle them up for you into some form and get right back to you on them. it's a bit of a tinkerer layout but iit sounds like you don't mind tinkering...

            Comment


              #7
              wow, I haven't looked at this thread in awhile - I got completely distracted and never implemented the pop-up warning. Now that that itch as been scratched I think I may need to go back and do this....

              Comment


                #8
                Thanks for sending this through - looking forward to it.

                Comment

                Working...
                X