Announcement

Collapse
No announcement yet.

Amalgamate Dawn/Dusk Sensors..

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

    Amalgamate Dawn/Dusk Sensors..

    Hey Blade, I'm wondering it is possible somehow to amalgamate dawn/dusk sensors like using active zones with motion detectors.

    I'm trying to create a virtual device of "Is Dark" which I'd like to take the data from all the of light sensors and determine if one of them is light or dark. If so, then set the status of the virtual device appropriately. I only care that one of the group of sensors is either light or dark to set this flag.

    I've tried setting up events such as
    Code:
    "If light sensor 1 value within range [0...3000] OR If light sensor 2 value within range [0...3000] OR If light sensor 3 etc" then device "Is Dark" to ON
    Code:
    "If light sensor 1 value within range [3001...10000] OR If light sensor 2 value within range [3001...10000] OR If light sensor 3 etc" then device "Is Dark" to OFF
    But I get conflicts as invariably one sensor will still be light while the other 3 show dark causing homeseer to fire ON,OFF,ON,OFF repeatedly to the virtual device.

    any help would be appreciated!

    Cheers,
    M

    #2
    I may not understand exactly what you intend to do, but if you have multiple light/dark detectors, one of them will almost certainly change before the rest; and one will be the last to change. So if you check them all, there will be some transition time when at least one will report dark and at least one will report light. I use a script to count how many sensors are on, then make a decision based on that. Is that what you want to do?
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548, NUC i3

    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

    Comment


      #3
      That's exactly what I'm looking to do! I have a few sensors on the main floor and I base motion lighting on those. I was using events based upon the individual light levels but would prefer just one virtual device that says light or dark to use as a condition.

      If even one of the sensors says it's "dark" then I want to set my virtual device to dark. If even one of the sensors says it's light I want to set the device to "light".

      Do you mind sharing your script?

      Cheers!

      Comment


        #4
        Originally posted by manxam View Post
        If even one of the sensors says it's "dark" then I want to set my virtual device to dark. If even one of the sensors says it's light I want to set the device to "light".
        Do you understand why your criteria cannot work?
        If just one sensor says it's light, than at least one sensor will also say it's dark! You are asking a question that does not have an answer. You need to change your criteria.

        I actually use two scripts because I use a smaller subset of sensors to determine if it is not dark. You'll need to replace my device list with your own and change the loop index to reflect the number of devices you are checking.

        Dark script:
        Code:
        Public Sub Main(ByVal Parms As Object)
        
                ' A list of the Device Codes for all X10 light sensors to monitor
                Dim strSensor_addr() As String = {"A4", "A6", "A12", "A14", "B14", "D12", "F10", "H16", "K12", "K14"}
                Dim intStat As Integer
                Dim intCount As Integer = 0
                Dim intNight As Integer
                Dim I As Integer
        
                intNight = hs.DeviceStatus("[1")
        
                ' Check each motion sensor
                For I = 0 To 9
                    intStat = hs.DeviceStatus(strSensor_addr(I))
                    If intStat = 2 Then     ' If the light sensor is ON (dark) then count it
                        intCount = intCount + 1
                    End If
                Next 'I
        
                ' If 3 or more sensors are reporting dark, then set flag 'VDark'
                If intCount > 3 Then
                    hs.ExecX10("[18", "ON", 0, 0)
                    hs.ExecX10("[13", "ON", 0, 0)
                End If
        
            End Sub
        Not dark script:
        Code:
        Public Sub Main(ByVal Parms As Object)
        
                ' A list of the Device Codes for X10 light sensors to monitor
                Dim strSensor_addr() As String = {"A4", "A6", "B12", "F10", "K14"}
                Dim intStat As Integer
                Dim I As Integer
            Dim intCount As Integer = 0
        
                ' Check each light sensor
                For I = 0 To 4
                    intStat = hs.DeviceStatus(strSensor_addr(I))
                    If intStat = 2 Then intCount += 1
                Next 'I
        
                ' If no more than 2 sensors are on (dark) then clear the VDark flag
                If intCount < 3 Then hs.ExecX10("[18", "OFF", 0, 0)
        
            End Sub
        Mike____________________________________________________________ __________________
        HS3 Pro Edition 3.0.0.548, NUC i3

        HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

        Comment


          #5
          Originally posted by Uncle Michael View Post
          Do you understand why your criteria cannot work?
          If just one sensor says it's light, than at least one sensor will also say it's dark! You are asking a question that does not have an answer. You need to change your criteria.

          I actually use two scripts because I use a smaller subset of sensors to determine if it is not dark. You'll need to replace my device list with your own and change the loop index to reflect the number of devices you are checking.

          Dark script:
          Code:
          Public Sub Main(ByVal Parms As Object)
          
                  ' A list of the Device Codes for all X10 light sensors to monitor
                  Dim strSensor_addr() As String = {"A4", "A6", "A12", "A14", "B14", "D12", "F10", "H16", "K12", "K14"}
                  Dim intStat As Integer
                  Dim intCount As Integer = 0
                  Dim intNight As Integer
                  Dim I As Integer
          
                  intNight = hs.DeviceStatus("[1")
          
                  ' Check each motion sensor
                  For I = 0 To 9
                      intStat = hs.DeviceStatus(strSensor_addr(I))
                      If intStat = 2 Then     ' If the light sensor is ON (dark) then count it
                          intCount = intCount + 1
                      End If
                  Next 'I
          
                  ' If 3 or more sensors are reporting dark, then set flag 'VDark'
                  If intCount > 3 Then
                      hs.ExecX10("[18", "ON", 0, 0)
                      hs.ExecX10("[13", "ON", 0, 0)
                  End If
          
              End Sub
          Not dark script:
          Code:
          Public Sub Main(ByVal Parms As Object)
          
                  ' A list of the Device Codes for X10 light sensors to monitor
                  Dim strSensor_addr() As String = {"A4", "A6", "B12", "F10", "K14"}
                  Dim intStat As Integer
                  Dim I As Integer
              Dim intCount As Integer = 0
          
                  ' Check each light sensor
                  For I = 0 To 4
                      intStat = hs.DeviceStatus(strSensor_addr(I))
                      If intStat = 2 Then intCount += 1
                  Next 'I
          
                  ' If no more than 2 sensors are on (dark) then clear the VDark flag
                  If intCount < 3 Then hs.ExecX10("[18", "OFF", 0, 0)
          
              End Sub
          UM for what purpose do you this script for? If I may ask......
          Last edited by Rotech; July 13, 2012, 10:32 PM.
          Hector
          ____________________________________
          Win.2003 OS, HS3
          BLDSC,BLstat,BLRadar,BLRamdom,BLOccupied
          BLups,BLrain8,HSTouch,Ultrajones Weatherbug,
          MyTrigger,ACRF2,W800,Zwave
          AP800,Honeywell Stat

          Comment


            #6
            UM,

            I you think about it slightly differently for a virtual device it should work.

            If even one of the sensors CHANGES TO it's "dark" then I want to set my virtual device to dark. If even one of the sensors CHANGES TO it's light I want to set the device to "light".

            You are looking for change, not "is", which as you say will not work.
            In old electronics design it would mean 2 mono-stables on each sensor one for light, say rising O/P the other for dark, say falling O/P, each light or dark MS ORed together to change the virtual device.

            Comment


              #7
              Originally posted by Rotech View Post
              UM for what purpose do you this script for? If I may ask......
              I have some lighting scenes that change depending on how light it is. Most of the time the lights turn off in an unoccupied room after some delay, but some rooms have the room lights dimmed to a low level instead if it is dark enough. Because we are surrounded by trees, a very cloudy day can be enough, so I found I could not always rely on sunrise/sunset criteria.

              FWIW, I use these sensors as just one input. I also have a solar sensor on my Davis weather station and a home-made light level sensor. Both of those are also used for input.
              Mike____________________________________________________________ __________________
              HS3 Pro Edition 3.0.0.548, NUC i3

              HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

              Comment


                #8
                Originally posted by Microchip View Post
                I you think about it slightly differently for a virtual device it should work. If even one of the sensors CHANGES TO it's "dark" then I want to set my virtual device to dark. If even one of the sensors CHANGES TO it's light I want to set the device to "light".
                Exactly. You could probably accomplish it with two events for each sensor. One if it changes to On, and one if it changes to Off. (I'm not sure if you'd need to add conditions for the states of the other sensors or not, but that would make it a bit more tedious to set up.)

                That would be an interesting way to change the criteria. Of course, depending on the location and relative sensitivities of the sensors, it could still lead to some oscillation, but it would still be useful to try it to see.

                In my case, I was most interested in avoiding oscillation, so that's why I settled on the 'voting' approach.
                Mike____________________________________________________________ __________________
                HS3 Pro Edition 3.0.0.548, NUC i3

                HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

                Comment


                  #9
                  Thanks for your help UM. I made some changes to your script which suited my install a little better and all is working exactly as needed. Basically just iterating through the list and setting the device value/status based upon the number of sensors in either light or dark state. Thanks very much for the ground work!

                  When I first wrote my events they looked solid but it wasn't until I saw a log full of ON-OFF-ON-OFF... that I realized what I had done

                  Cheers,
                  M

                  Comment


                    #10
                    Great. Glad it was of use.
                    Mike____________________________________________________________ __________________
                    HS3 Pro Edition 3.0.0.548, NUC i3

                    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

                    Comment

                    Working...
                    X