Announcement

Collapse
No announcement yet.

Sync Two Dimmers

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

    Sync Two Dimmers

    What would be the easiest way to make two separate dimmers stay in sync? so if you change on, the other matches its state?

    I have EasyTrigger, and put them in a device group, but can't figure out what to do next.

    THanks.

    #2
    Why not link them together? Then they would always be in sync including on/off.

    Comment


      #3
      Originally posted by AllHailJ View Post
      Why not link them together? Then they would always be in sync including on/off.
      duh. damn i hate when i forget things. thanks.

      Comment


        #4
        so this worked perfectly for one of my needs, but i have a different scenario that is similar.

        I want to be able to control three lights individual, but i also want a composite device (maybe a virtual device) that will allow me to control these lights (including dimming) as one.

        So... for example, if i dim the virtual device, all three of the lights dim together at the same level. But if i select one of the actual devices independently, i can dim that separately from the others?

        Comment


          #5
          This could be done easily with a script if all dimmers are the same. Here is a script that makes all scenes run if pushed from any selected device. Are you familiar with scripting? I think you could also do it with easy trigger by grouping the three switches together and making the virtual switch the trigger. The trigger would be the device value has changed within the last second. Then set the device value of each device to the virtual device

          Code:
          REM - Control a scene script that will work from both event and HSTouch
          REM - 1/4/2020
          REM - Script has no Parameters passed
          
          IMPORTS System.IO
          'IMPORTS System.Net
          'IMPORTS System.Threading
          
          Sub Main(ByVal parms As Object)  
          
              Dim LinkedTime, DeviceTime, sScene(10) As String
              Dim sName As String 'string name for the log
              Dim idvRef(3) As Integer 'Central Scene Devices
              Dim jdvRef(3) As Integer 'Control Devices
              Dim cc As CAPIControl
              Dim i, dvRef, Maxdv, iCase As Integer
          
              sName = "CtlScene"
              Maxdv = 3   'Change this to the number of devices that you want to control
          
              REM Initialize the device reference numbers
              idvRef(0) = 614
              idvRef(1) = 3336
              idvRef(2) = 3339
              idvRef(3) = 3343
              jdvRef(0) = 614
              jdvRef(1) = 3337
              jdvRef(2) = 3340
              jdvRef(3) = 3344
          
              REM - Set the control string text.
              sScene(1)  = "Scene 001 Key Pressed 1 Time"
              sScene(2)  = "Scene 001 Key Released"
              sScene(3)  = "Scene 001 Key Held Down"
              sScene(4)  = "Scene 001 Key Pressed 2 Times"
              sScene(5)  = "Scene 001 Key Pressed 3 Times"
              sScene(6)  = "Scene 002 Key Pressed 1 Time"
              sScene(7)  = "Scene 002 Key Released"
              sScene(8)  = "Scene 002 Key Held Down"
              sScene(9)  = "Scene 002 Key Pressed 2 Times"
              sScene(10) = "Scene 002 Key Pressed 3 Times"
              i  = hs.DeviceValue(idvRef(0)) 'get the value of the virtual device
              if i > 1999 Then
                  i = i - 1999
              Else
                  i = i - 999
              End If
              sScene(0) = sScene(i)
          
              iCase = 0
              For i = 1 to 10
                  If sScene(0) = sScene(i) Then
                      'hs.WriteLog(sName, "Found match: Cnt = " & CStr(i) & "Scene Text is: " & sScene(i) & " " & sScene(0))
                      iCase = i
                      Exit For
                  End If
              Next
          
              If iCase = 0 Then
                  hs.WriteLog(sName,"Never found a Match Exited Script for Scene:" & sScene(0))
                  Exit Sub
              End If
          
              LinkedTime = hs.DeviceLastChangeRef(idvRef(0)).ToLongTimeString 'Virtual Device Change Time in string format
              'hs.writelog(sName,"Made past LinkedTime")
          
              dvRef = 0
          
              For i = 1 to Maxdv
                  DeviceTime = hs.DeviceLastChangeRef(idvRef(i)).ToLongTimeString 'Current Device Change Time in string Format
                  If LinkedTime = DeviceTime Then
                      dvRef = jdvRef(i)   'Found the device that changed so record and quit looking
                      'hs.writelog(sName,"Found the device")
                      Exit For
                  End if
              Next
          
          
              if dvRef = 0 Then  '  If we did not find a match, then leave a message and exit
                  hs.writelog(sName,"Did not find a Device to match virtual device.  Exit Program")
                  Exit Sub
              End If
          
              'hs.writelog(sName,"Made it to the select case")
          
              Select Case iCase
                  Case 1 'Scene 001 Key Pressed 1 Time
                      hs.WriteLog(sName,sScene(1))
                      hs.writelog(sName, CSTR(dvRef) & " Device set to 100%") ' Turn Device to full on
                      cc = hs.CAPIGetSingleControl(dvRef, True, "Dim (value)%", False, False)
                      cc.ControlValue = 99
                      hs.CAPIControlHandler(cc) ' Control the device
                  Case 2 'Scene 001 Key Released
                      hs.WriteLog(sName,sScene(2))
                  Case 3 'Scene 001 Key Held Down
                      hs.WriteLog(sName,sScene(3))
                      hs.WriteLog(sName,"Need logic to arm system")
                      hs.WriteLog(sName, CSTR(dvRef) & " System Armed")
                  Case 4 'Scene 001 Key Pressed 2 Times
                      hs.WriteLog(sName,sScene(4))
                      hs.WriteLog(sName, CSTR(dvRef) & " Device set to 30%")
                      cc = hs.CAPIGetSingleControl(dvRef, True, "Dim (value)%", False, False)
                      cc.ControlValue = 30
                      hs.CAPIControlHandler(cc) 'Control the device
                  Case 5 'Scene 001 Key Pressed 3 Times
                      hs.WriteLog(sName,sScene(5))
                  Case 6 'Scene 002 Key Pressed 1 Time
                      hs.WriteLog(sName,sScene(6))
                  Case 7 'Scene 002 Key Released
                      hs.WriteLog(sName,sScene(7))
                  Case 8 'Scene 002 Key Held Down
                      hs.WriteLog(sName,sScene(8))
                  Case 9 'Scene 002 Key Pressed 2 Times
                      hs.WriteLog(sName,sScene(9))
                  Case 10 'Scene 002 Key Pressed 3 Times
                      hs.WriteLog(sName,sScene(10))
              End Select
          
          
          End Sub

          Comment


            #6
            The EasyTrigger action 'Set Device to another Device' might be useful.

            Create a virtual dimmer device with the same range as a normal dimmer. Then

            IF virtualDimmer changes and becomes any value
            THEN Set Device dimmer1 to virtualDimmer
            THEN Set Device dimmer2 to virtualDimmer
            etc.

            Comment


              #7
              Originally posted by AllHailJ View Post
              This could be done easily with a script if all dimmers are the same. Here is a script that makes all scenes run if pushed from any selected device. Are you familiar with scripting? I think you could also do it with easy trigger by grouping the three switches together and making the virtual switch the trigger. The trigger would be the device value has changed within the last second. Then set the device value of each device to the virtual device
              Not good at scripting yet... but that's coming down road :-)

              for Easytrigger, i think i get the idea... this is where i got and then was stuck...

              Click image for larger version

Name:	Annotation 2020-05-25 143925.jpg
Views:	177
Size:	86.8 KB
ID:	1388520

              Comment


                #8
                Wrong event action - use 'EasyTrigger: Set Device to another Device' instead.

                Comment


                  #9
                  Originally posted by zwolfpack View Post
                  Wrong event action - use 'EasyTrigger: Set Device to another Device' instead.
                  Right on!... worked perfectly. thanks!!!!

                  Comment

                  Working...
                  X