Announcement

Collapse
No announcement yet.

Status for any light on

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

    Status for any light on

    I'm setting up Imperihome and I have a house 'dashboard'. What I would like to do is have a single indicator showing if any light is on in the house.

    I setup a virtual device and turn it 'on' with the event logic.

    If light1 changes and becomes 1 to 255
    ORIF light2 changes and becomes 1 to 255
    ORIF light3 changes and becomes 1 to 255
    ORIF light"x" changes and becomes 1 to 255
    Then set device lightstatus to ON

    This tells me if any light is ON in the house

    How the heck to turn it off?
    If light1 changes and becomes off
    ANDIF light2 is off
    ANDIF light3 is off
    Then set device to lightstatus to OFF

    I would have to create an event for each combination such as
    If light2 changes and becomes off
    ANDIF light1 is off
    ANDIF light3 is off
    Then set device to lightstatus to OFF

    Guru's, is there a better way to do this? This seems awfully cumbersome if there are 100 lights.
    Last edited by gmab; June 15, 2016, 11:54 AM.

    #2
    Not sure of your scripting abilities, but you could make a basic script that you could pass parameters to. It would still be one event to check device changes, but use that event to pass the data to the script and control the virtual device.

    Comment


      #3
      Why not use a composite widget in Imperihome and select all your lights with it?

      Cheers
      Al
      HS 4.2.8.0: 2134 Devices 1252 Events
      Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

      Comment


        #4
        Originally posted by waynehead99 View Post
        Not sure of your scripting abilities, but you could make a basic script that you could pass parameters to. It would still be one event to check device changes, but use that event to pass the data to the script and control the virtual device.
        Scripting abilities are minimal at the moment but plan on playing around with a few scripts.

        Originally posted by sparkman View Post
        Why not use a composite widget in Imperihome and select all your lights with it?
        I did have a composite to begin with, but there isn't a status-only composite. I would accidentally hit the on/off button hence changing everything in the house at once.
        I played around with trying to make the lights sensors and using composite that way but it didn't work out very well.

        Of course right after I posted this I found a solution. I can use this with Imperihome, HSTouch, and Scene Controllers.

        The ON logic above works fine.

        OFF logic requires 2 events.

        If light1 changes and becomes OFF
        ORIF light2 changes and becomes OFF
        ORIF light3 changes and becomes OFF
        ORIF lightx changes and becomes OFF
        Then run event eventname

        This event is manually run
        ANDIF light1 has value equal to OFF
        ANDIF light2 has value equal to OFF
        ANDIF light3 has value equal to OFF
        ANDIF lightx has value equal to OFF
        Then set device to OFF

        Comment


          #5
          Here is a quick script to track which lights are on and update a virtual device (replace ref 763 with your Virtual Device). You will also need to edit your device location (dv.Loacation2) for your lighting location.

          It may need a bit of clean up but works:

          Code:
          Sub Main(Parm As Object)
          
          'Script to display Light Status
          
          Dim Status
          Dim DeviceVal
          
          Dim Offf'0
          Dim OnOn'1
          
          
          
          OnOn = ""
          Offf = ""
          
          Dim col As New Collections.Generic.List(Of Scheduler.Classes.DeviceClass)
                  Dim dv As Scheduler.Classes.DeviceClass
          
                  Dim EN As Scheduler.Classes.clsDeviceEnumeration
                  EN = hs.GetDeviceEnumerator
                  Do
                      dv = EN.GetNext
                      If dv Is Nothing Then Continue Do
                      col.Add(dv)
                  Loop Until EN.Finished
          
                  If col IsNot Nothing AndAlso col.Count > 0 Then
                      For Each dv In col
                          If dv Is Nothing Then Continue For
          
          		If  dv.Location2(Nothing)= "Lighting" then 
          		DeviceVal= hs.DeviceValue(dv.Ref(Nothing))
          
          If DeviceVal = 0 then
          Offf = Offf & dv.Name(Nothing) & ", " & "<Br>"
          Else
          OnOn  = OnOn & dv.Location(Nothing) & ":- " & dv.Name(Nothing) &  ", " & "<Br>"
          End If
          
          'hs.writelog ("OK", OnOn)
          'hs.WriteLog("Ref: " & dv.Ref(Nothing), dv.Name(Nothing) & " " & DeviceVal & " " & Status) 'Update HS Log
          'hs.WriteLog("Ref: " & dv.Ref(Nothing), dv.Name(Nothing) & " " & dv.Location(Nothing) & " " & dv.Location2(Nothing))
          
          			End If
                     Next
                End If
          
          
          If OnOn = "" then OnOn = "All Lights are Off"
          hs.SetDeviceString(763, Trim(OnOn), True)
          
          
          End Sub
          Last edited by DSteiNeuro; June 15, 2016, 12:38 PM.
          DSteiNeuro

          HS3Pro

          MSI Cubi Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz, 2201 Mhz, 2 Core(s), 4 Logical Processor(s) 16GB DDRl RAM

          Enabled Plug-Ins
          BLRussound, BLSpeech, HSTouch Server, JowiHue, MyQ, Nest, Rain8, Squeezebox, Ultra1Wire3, UltraGCIR3, Vista Alarm, X10,Z-Wave

          Comment


            #6
            How are you calling that script? Are you passing parameters to it?

            I have a couple different ideas on how to do this with an event and without an event.

            Comment


              #7
              You could do it either way but no need to pass parameters if you set the virtual device Ref and your location for lighting devices in the script.

              I thnk that I just run the script manually but you could set other triggers.
              I use a similar script for a bunch of other devices, for example to see which alarm zones are open.
              DSteiNeuro

              HS3Pro

              MSI Cubi Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz, 2201 Mhz, 2 Core(s), 4 Logical Processor(s) 16GB DDRl RAM

              Enabled Plug-Ins
              BLRussound, BLSpeech, HSTouch Server, JowiHue, MyQ, Nest, Rain8, Squeezebox, Ultra1Wire3, UltraGCIR3, Vista Alarm, X10,Z-Wave

              Comment


                #8
                Originally posted by DSteiNeuro View Post
                Here is a quick script to track which lights are on and update a virtual device
                Thanks for posting the script, I have just started working on scripting and this will give me something to play with.

                Mark

                Comment


                  #9
                  If you want to solve this with events only, make one event that has a bunch of Or If's to check if ANY light was turned off, then have the Then action of that event run another event. The second event's If trigger is manually triggered, then it has a bunch of And If conditions to check if ALL lights are turned off, with a Then action of controlling your virtual device. I do the same thing in an event to turn the heat back on when all windows are closed.

                  [Edit] Missed post 4 where this solution was already found.

                  Comment

                  Working...
                  X