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.548: 1976 Devices 1156 Events
    Z-Wave 3.0.1.262: 123 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:	7
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:	8
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:	7
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:	8
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


            • #7
              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:	7
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:	8
Size:	34.9 KB
ID:	1282395
              Do you have a release date for your plugin?

              Comment


              • #8
                Originally posted by dibble9012 View Post
                Do you have a release date for your plugin?
                http://plugins.homeseer.com/releasenotes?productid=313

                https://www.youtube.com/watch?v=mmyrx8kXnWY

                Comment


                • #9
                  Currently it shows in the device status string only the last device name cased the trigger. I'm working on next version which will show the list of all devices matching the condition, i.e. all open windows/doors. But it looks a bit less readable.

                  Comment

                  Working...
                  X