Announcement

Collapse
No announcement yet.

Script for combining contact sensors?

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

  • Script for combining contact sensors?

    I have windows that have two slider portions per window. Could I create a script (instead of an event) that takes those two window sensors and sets the status of a status only virtual contact sensor? For example if either one is open, the virtual one is open. If both are closed, the virtual is closed?

  • #2
    Yes, that could be done with a simple script.
    HS 3.0.0.500: 1984 Devices 1111 Events
    Z-Wave 3.0.1.256: 114 Nodes on one Z-Net

    Comment


    • #3
      How?


      Sent from my iPhone using Tapatalk

      Comment


      • #4
        I'm working on plugin which will allow combining devices easily without using events:

        Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	49.6 KB
ID:	1282394

        And you can even add the device name which caused the change to the status string:

        Click image for larger version

Name:	2019-02-05 (1).png
Views:	1
Size:	34.9 KB
ID:	1282395

        Comment


        • #5
          Originally posted by alexbk66 View Post
          I'm working on plugin which will allow combining devices easily without using events:

          Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	49.6 KB
ID:	1282394

          And you can even add the device name which caused the change to the status string:

          Click image for larger version

Name:	2019-02-05 (1).png
Views:	1
Size:	34.9 KB
ID:	1282395
          That’s awesome. Let me know if you need someone to test it!


          Sent from my iPhone using Tapatalk

          Comment


          • #6
            This is what I use to display the status of my motion sensors, windows and doors. This script triggers whenever one of these devices changes state

            If there are 2 doors open at the same time, they will both be listed in the door device under each other

            Code:
            dim array_motion() as string = {"Hall motion","Front door motion sensor","Garage Motion Sensor","Motion camera back door","Motion camera garage","Motion camera hall","Motion camera lounge","Motion Lounge"}
            dim motions_count as integer = 0
            dim motion_name as string = ""
            dim wstr as string = ""
            
            sub motion(ByVal Parms as Object)
            Try
            motions_count = 0
            motion_name = ""
            wstr = ""
             for each devw as string in array_motion
                if hs.DeviceValueByName(devw) = 255 or hs.DeviceValueByName(devw) = 100 then
                    motions_count = motions_count + 1
                    motion_name = devw
                    wstr = wstr & motion_name & " <span style='color:red'>MOTION</span>" & "<br>"
                Else If hs.DeviceValueByName(devw) = 0 then
                end if
            next
                If motions_count > 0 then
                    hs.SetDeviceValueByRef(470,100,true)
                    hs.SetDeviceString(470, wstr,true)
                Else
                    hs.SetDeviceValueByRef(470,0,true)
                    hs.SetDeviceString(470, "No Motion",true)
                End If
            
                hs.writelog("Array", "Motion Sensor Count: " & motions_count)
             Catch ex As Exception
            hs.WriteLog ("Array", "Error: " & ex.Message)
            End Try
            End Sub
            Attached Files

            Comment

            Working...
            X