Announcement

Collapse
No announcement yet.

Is there a simple way of knowing which device triggered ?

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

    Is there a simple way of knowing which device triggered ?

    I want to create a event which is triggered by any of my door or window sensors, but only if the house is set to away. That's easy.
    But I would like to use the group condition at the bottom to then send a notification which includes which device actually triggered the event. Is that possible ? I don't want to have a event for each device, unless I need to.

    #2
    Yes
    I do that, I send out an email with all the motion sensors current conditions.


    Sent from my iPhone using Tapatalk

    Comment


      #3
      What does your event look like ?

      Comment


        #4
        Originally posted by gd1210 View Post
        Yes
        I do that, I send out an email with all the motion sensors current conditions.


        Sent from my iPhone using Tapatalk
        Interesting...
        Hector
        ____________________________________
        Win.2003 OS, HS3
        BLDSC,BLstat,BLRadar,BLRamdom,BLOccupied
        BLups,BLrain8,HSTouch,Ultrajones Weatherbug,
        MyTrigger,ACRF2,W800,Zwave
        AP800,Honeywell Stat

        Comment


          #5
          What I do. I have one event that looks at all the windows. If they change status, they run a script that updates a virtual device with what windows are opened. I do the same with the doors as well. I then use the virtual device for 2 things... I can trigger off it easily for any window and it updates which window just opened. Also to display the data in HSTouch.

          Edit: The script needs some cleaning up. I recently moved the control of my Whole House Fan to another script, so everything for that is commented out. If you want more help on using this, let me know and we can fine tune it for your needs.

          Code:
          'Define Windows/Doors Array
          
          '604 Master Bathroom Right Window
          '600 Master Bathroom Left Window
          '502 Master Bedroom Right Window
          '498 Master Bedroom Left Window
          '394 Loft Window
          '55 Dining/Piano Windows
          '53 Laundry/TV Windows
          
          '58 Garage Door from Laundry
          '54 Front Door
          '57 Back Door
          
          dim array_windows() as string = {"Master Bathroom Right Window","Master Bathroom Left Window","Master Bedroom Right Window","Master Bedroom Left Window","Loft Window","Dining/Piano Windows","Laundry/TV Windows"}
          dim array_doors() as string = {"Garage Door","Front Door","Back Door"}
          dim windows_count as integer = 0
          dim doors_count as integer = 0
          dim locked as integer = 0
          dim door_name as String = ""
          dim dstr as string = ""
          dim window_name as string = ""
          dim wstr as string = ""
          dim outside_temp as integer = 0
          dim temp_threshold as integer = 60 'Set outside temperature for fan to turn on
          
          sub windows(ByVal Parms as Object)
          Try
          windows_count = 0
          window_name = ""
          wstr = ""
          outside_temp = hs.DeviceValueEx(864)
          'Counts thru array to check if any windows are opened
          for each devw as string in array_windows
              if hs.DeviceValueByName(devw) = 255 or hs.DeviceValueByName(devw) = 100 then
                  windows_count = windows_count + 1
                  window_name = devw
                  wstr = wstr & window_name & " Opened" & "<br>"
              Else If hs.DeviceValueByName(devw) = 0 then 'No windows open
              end if
          next
              If windows_count > 0 then 
                  hs.SetDeviceValueByRef(171,100,true)
                  hs.SetDeviceString(171, wstr,true)
              Else
                  hs.SetDeviceValueByRef(171,0,true)
                  hs.SetDeviceString(171, "All Windows Closed",true)
              End If
              
              if (outside_temp > temp_threshold andalso windows_count > 0 andalso windows_count < 4) then
                  'hs.CAPIControlHandler(hs.CAPIGetSingleControl(493,true ,"on",false,true))
                  'hs.CAPIControlHandler(hs.CAPIGetSingleControl(494,true ,"off",false,true))
                  'ElseIf (outside_temp > temp_threshold andalso windows_count > 2 andalso windows_count < 4) then
                  '    hs.CAPIControlHandler(hs.CAPIGetSingleControl(493,true ,"off",false,true))
                  '    hs.CAPIControlHandler(hs.CAPIGetSingleControl(494,true ,"on",false,true))
                      ElseIf (outside_temp > temp_threshold andalso windows_count > 3) then
                          'hs.CAPIControlHandler(hs.CAPIGetSingleControl(493,true ,"on",false,true))
                          'hs.CAPIControlHandler(hs.CAPIGetSingleControl(494,true ,"on",false,true))
                  ElseIf windows_count = 0
                  'hs.CAPIControlHandler(hs.CAPIGetSingleControl(493,true ,"off",false,true))
                  'hs.CAPIControlHandler(hs.CAPIGetSingleControl(494,true ,"off",false,true))
              End If    
              hs.writelog("Array", "Window Count: " & windows_count)
          
          Catch ex As Exception
          hs.WriteLog ("Array", "Error: " & ex.Message)
          End Try
          End Sub
          
          sub doors(ByVal Parms as Object)
          Try
          doors_count = 0
          locked = hs.DeviceValueEx(1069)
          door_name = ""
          dstr = ""
          for each devd as string in array_doors
              if hs.DeviceValueByName(devd) = 255 or hs.DeviceValueByName(devd) = 100 then
                  doors_count = doors_count + 1
                  door_name = devd
                  dstr = dstr & door_name & " Opened" & "<br>"
              Else If hs.DeviceValueByName(devd) = 0 then 'No doors open
              end if
          next
              If doors_count > 0 then 
                  hs.SetDeviceValueByRef(170,100,true)
                  hs.SetDeviceString(170, dstr,true)
                  ElseIf (doors_count = 0 and locked = 255) then
                          hs.SetDeviceValueByRef(170,150,true)
                          hs.SetDeviceString(170, "All Doors Closed and Locked",true)
              Else
                  hs.SetDeviceValueByRef(170,0,true)
                  hs.SetDeviceString(170, "All Doors Closed",true)
              End If
          Catch ex As Exception
          hs.WriteLog ("Array", "Error: " & ex.Message)
          End Try
          End Sub
          Attached Files
          Last edited by waynehead99; June 20, 2016, 02:59 PM.

          Comment


            #6
            Is there a simple way of knowing which device triggered ?

            Basically in away mode
            I look at all he sensors.
            Then the email goes out on every motion sense.
            So if it's a false alarm for example I get an email saying kitchen has detected motion. Then that's it. But if I then get an email saying, dining room detected motion then hall you can effectively see someone move though the house

            Click image for larger version

Name:	Image1466453945.694810.jpg
Views:	1
Size:	246.3 KB
ID:	1185156

            Click image for larger version

Name:	Image1466453959.755272.jpg
Views:	1
Size:	46.6 KB
ID:	1185157


            I avoid scripts where possible.
            My experience is that when you hit problems.
            Although it looks like I'll have to do a script to do the heating the way I want


            Sent from my iPhone using Tapatalk

            Comment


              #7
              Originally posted by gd1210 View Post
              Basically in away mode
              I look at all he sensors.
              Then the email goes out on every motion sense.
              So if it's a false alarm for example I get an email saying kitchen has detected motion. Then that's it. But if I then get an email saying, dining room detected motion then hall you can effectively see someone move though the house

              [ATTACH]54939[/ATTACH]

              [ATTACH]54940[/ATTACH]


              I avoid scripts where possible.
              My experience is that when you hit problems.
              Although it looks like I'll have to do a script to do the heating the way I want


              Sent from my iPhone using Tapatalk
              What is your group condition?
              Hector
              ____________________________________
              Win.2003 OS, HS3
              BLDSC,BLstat,BLRadar,BLRamdom,BLOccupied
              BLups,BLrain8,HSTouch,Ultrajones Weatherbug,
              MyTrigger,ACRF2,W800,Zwave
              AP800,Honeywell Stat

              Comment


                #8
                Originally posted by waynehead99 View Post
                locked = hs.DeviceValueEx(1069)
                To what does this statement refer?

                EDIT: Never mind. I got it. It's the Lock/Unlock status of a door lock.
                Last edited by randycboone; July 27, 2016, 12:35 PM.

                Comment

                Working...
                X