Announcement

Collapse
No announcement yet.

Associating 3-way switch - howto

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

    #16
    Good info and by searching google for cooper rf sync this appears to be a cooper issue and I can't believe they haven't fixed it.

    Al - I implemented your script and it seems to partially be working. If I turn the slave off, it turns the master off. If I turn the master off, it turns the slave off. The half that is not working is getting the turn on button to sync. If I turn on the master, the slave does nothing and if I turn the slave on the master does nothing. Not sure what I'm missing - anything obvious?

    The master switch is Ref ID=53 and Slave is Ref ID=54.

    I put the script in Debug=True mode. If you read from the bottom up it looks like "Dim Follower" is setting both 53 and 54 to 99 but the device is not updating to being on. Then when I turn the light off the other device is already at the same value because it never changed. (Nice script with debug mode!)


    Oct-19 10:56:28 PM Dim Follower Devices are at same value already
    Oct-19 10:56:28 PM Dim Follower 54:0
    Oct-19 10:56:28 PM Event Running script in background: /home/hs3/HomeSeer/scripts/switchsync.vb("Main","54,53")
    Oct-19 10:56:28 PM Event Event Trigger "Test Area Events sync script vb"
    Oct-19 10:56:28 PM Z-Wave Device: First Floor Kitchen Kitchen Table Light Slave Set to 0
    Oct-19 10:56:28 PM Device Control Device: First Floor Kitchen Kitchen Table Light Slave to Off (0) by/from: CAPI Control Handler
    Oct-19 10:56:15 PM Dim Follower 53:99
    Oct-19 10:56:15 PM Dim Follower 54:99
    Oct-19 10:56:15 PM Event Running script in background: /home/hs3/HomeSeer/scripts/switchsync.vb("Main","54,53")
    Oct-19 10:56:15 PM Event Event Trigger "Test Area Events sync script vb"
    Oct-19 10:56:15 PM Z-Wave Device: First Floor Kitchen Kitchen Table Light Slave Set to 99
    Oct-19 10:56:15 PM Device Control Device: First Floor Kitchen Kitchen Table Light Slave to On (99) by/from: CAPI Control Handler
    Oct-19 10:56:07 PM Dim Follower Devices are at same value already
    Oct-19 10:56:07 PM Dim Follower 53:0
    Oct-19 10:56:07 PM Event Running script in background: /home/hs3/HomeSeer/scripts/switchsync.vb("Main","53,54")
    Oct-19 10:56:07 PM Event Event Trigger "Test Area Events sync script vb - Copy"
    Oct-19 10:56:07 PM Z-Wave Device: First Floor Kitchen Kitchen Table Light Master Set to 0
    Oct-19 10:56:07 PM Device Control Device: First Floor Kitchen Kitchen Table Light Master to Off (0) by/from: CAPI Control Handler
    Oct-19 10:55:15 PM Dim Follower 54:99
    Oct-19 10:55:15 PM Dim Follower 53:99
    Oct-19 10:55:15 PM Event Running script in background: /home/hs3/HomeSeer/scripts/switchsync.vb("Main","53,54")
    Oct-19 10:55:15 PM Event Event Trigger "Test Area Events sync script vb - Copy"
    Oct-19 10:55:15 PM Z-Wave Device: First Floor Kitchen Kitchen Table Light Master Set to 99
    Oct-19 10:55:15 PM Device Control Device: First Floor Kitchen Kitchen Table Light Master to On (99) by/from: CAPI Control Handler
    Attached Files
    Last edited by denisl; October 19, 2015, 09:43 PM.

    Comment


      #17
      Originally posted by denisl View Post
      Al - I implemented your script and it seems to partially be working. If I turn the slave off, it turns the master off. If I turn the master off, it turns the slave off. The half that is not working is getting the turn on button to sync. If I turn on the master, the slave does nothing and if I turn the slave on the master does nothing. Not sure what I'm missing - anything obvious?
      I may have to add a separate case statement for the on condition. Can you take a screen shot of the advanced tab of the switch when the switch is on and post the screen shot here?

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

      Comment


        #18
        Hi Al - here is the image of the master switch in the "on" position.

        Also - the script syncs the dimmer settings perfectly also. Off and any dim setting is synced up. Only the full "on" position doesn't sync.
        Attached Files
        Last edited by denisl; October 20, 2015, 05:53 PM.

        Comment


          #19
          Give the script below a try and let me know how it works. I haven't had a chance to test it. If it still doesn't work, can you post the log entries that occur when it runs?

          Cheers
          Al

          Code:
          Sub Main(ByVal Parms as String)
          
          	Dim ParmArray() as String
          	ParmArray = Parms.tostring.split(",")
          	dim targetDev1 as Double = CDbl(ParmArray(0))		'reference ID of the device to use for existing value
          	dim targetDev2 as Double = CDbl(ParmArray(1))		'reference ID of the device to set based on value of targetDev1
          	dim Debug as Boolean = True
          	Dim logName = "Dim Follower"								'set log name for HS log
          
          	Dim dev1Value,dev2Value As Double
          	dev1Value = hs.DeviceValue(targetDev1)
          	dev2Value = hs.DeviceValue(targetDev2)
          
          	If Debug Then hs.writelog(logName,CStr(targetDev1) & ":" & CStr(dev1Value))
          	If dev1Value <> dev2Value Then
          		Select Case dev1Value
          			Case 1 to 98
          				' Device DIM, set its current dim level
          				hs.CAPIControlHandler(hs.CAPIGetSingleControl(targetDev2, false, CStr(dev1Value), false, true))
          				If Debug Then hs.writelog(logName,CStr(targetDev2) & ":" & CStr(dev1Value))
          			Case 99
          				' Device ON, set it to on
          				hs.CAPIControlHandler(hs.CAPIGetSingleControl(targetDev2, false, "On", false, true))
          				If Debug Then hs.writelog(logName,CStr(targetDev2) & " Set to On")
          			Case 0
          				' Device OFF, set it to off
          				hs.CAPIControlHandler(hs.CAPIGetSingleControl(targetDev2, false, "Off", false, true))
          				If Debug Then hs.writelog(logName,CStr(targetDev2) & " Set to Off")
          		End Select
          	Else
          			If Debug Then hs.writelog(logName,"Devices are at same value already")
          	End If
          
          End Sub
          HS 4.2.8.0: 2134 Devices 1252 Events
          Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

          Comment


            #20
            Getting closer! Now on is working but when the target switch is updated to on it's going to "On Last Level". So what happens is I turn Ref=54 "on", script is putting Ref=53 "On Last level" setting it to 67% in this case, then event triggers on Ref=53 changing which kicks off script again and sets Ref=54 to 67%. Is there a different value for "On" vs. "On Last Value"?

            Edit: also just noticed that if I select "On Last Level" from hs3 web it goes to full on, then the target device is going to "on last level" which then circles back to the initial device setting it to on last level.

            By the way - THANK YOU so much for writing these updates for me. You're saving my setup.

            Oct-20 9:46:33 PM Dim Follower Devices are at same value already
            Oct-20 9:46:33 PM Dim Follower 54:67
            Oct-20 9:46:33 PM Event Running script in background: /home/hs3/HomeSeer/scripts/switchsync.vb("Main","54,53")
            Oct-20 9:46:33 PM Event Event Trigger "Test Area Events sync script vb"
            Oct-20 9:46:33 PM Z-Wave Device: First Floor Kitchen Kitchen Table Light Slave Set to 67
            Oct-20 9:46:33 PM Dim Follower 54:67
            Oct-20 9:46:33 PM Device Control Device: First Floor Kitchen Kitchen Table Light Slave to Dim 67% (67) by/from: CAPI Control Handler
            Oct-20 9:46:33 PM Dim Follower 53:67
            Oct-20 9:46:33 PM Event Running script in background: /home/hs3/HomeSeer/scripts/switchsync.vb("Main","53,54")
            Oct-20 9:46:33 PM Event Event Trigger "Test Area Events sync script vb - Copy"
            Oct-20 9:46:33 PM Z-Wave Device: First Floor Kitchen Kitchen Table Light Master Set to Dim 67%
            Oct-20 9:46:31 PM Dim Follower 53:255
            Oct-20 9:46:31 PM Event Running script in background: /home/hs3/HomeSeer/scripts/switchsync.vb("Main","53,54")
            Oct-20 9:46:31 PM Event Event Trigger "Test Area Events sync script vb - Copy"
            Oct-20 9:46:31 PM Z-Wave Device: First Floor Kitchen Kitchen Table Light Master Set to 255
            Oct-20 9:46:31 PM Dim Follower 53 Set to On
            Oct-20 9:46:31 PM Device Control Device: First Floor Kitchen Kitchen Table Light Master to On Last Level (255) by/from: CAPI Control Handler
            Oct-20 9:46:31 PM Dim Follower 54:99
            Oct-20 9:46:31 PM Event Running script in background: /home/hs3/HomeSeer/scripts/switchsync.vb("Main","54,53")
            Oct-20 9:46:31 PM Event Event Trigger "Test Area Events sync script vb"
            Oct-20 9:46:31 PM Z-Wave Device: First Floor Kitchen Kitchen Table Light Slave Set to 99
            Oct-20 9:46:31 PM Device Control Device: First Floor Kitchen Kitchen Table Light Slave to On (99) by/from: CAPI Control Handler
            Oct-20 9:46:26 PM Dim Follower Devices are at same value already
            Oct-20 9:46:26 PM Dim Follower 53:0
            Oct-20 9:46:26 PM Event Running script in background: /home/hs3/HomeSeer/scripts/switchsync.vb("Main","53,54")
            Oct-20 9:46:26 PM Event Event Trigger "Test Area Events sync script vb - Copy"
            Oct-20 9:46:26 PM Z-Wave Device: First Floor Kitchen Kitchen Table Light Master Set to 0
            Oct-20 9:46:26 PM Dim Follower 53 Set to Off
            Oct-20 9:46:26 PM Device Control Device: First Floor Kitchen Kitchen Table Light Master to Off (0) by/from: CAPI Control Handler
            Oct-20 9:46:26 PM Dim Follower 54:0
            Oct-20 9:46:26 PM Event Running script in background: /home/hs3/HomeSeer/scripts/switchsync.vb("Main","54,53")
            Oct-20 9:46:26 PM Event Event Trigger "Test Area Events sync script vb"
            Oct-20 9:46:26 PM Z-Wave Device: First Floor Kitchen Kitchen Table Light Slave Set to 0
            Oct-20 9:46:26 PM Device Control Device: First Floor Kitchen Kitchen Table Light Slave to Off (0) by/from: CAPI Control Handler
            Last edited by denisl; October 20, 2015, 08:48 PM.

            Comment


              #21
              You're very welcome! Glad to be able to help.

              I think I know what was happening. The CAPI command was finding a command that contained the word "on". Try this version, which should use the CAPI command that is exactly "on". I've highlighted the change from the previous version so you can just edit your existing file (changing to "true" to "false") in the commands in the Case 99 section.

              Cheers
              Al

              Code:
              Sub Main(ByVal Parms as String)
              
              	Dim ParmArray() as String
              	ParmArray = Parms.tostring.split(",")
              	dim targetDev1 as Double = CDbl(ParmArray(0))		'reference ID of the device to use for existing value
              	dim targetDev2 as Double = CDbl(ParmArray(1))		'reference ID of the device to set based on value of targetDev1
              	dim Debug as Boolean = True
              	Dim logName = "Dim Follower"								'set log name for HS log
              
              	Dim dev1Value,dev2Value As Double
              	dev1Value = hs.DeviceValue(targetDev1)
              	dev2Value = hs.DeviceValue(targetDev2)
              
              	If Debug Then hs.writelog(logName,CStr(targetDev1) & ":" & CStr(dev1Value))
              	If dev1Value <> dev2Value Then
              		Select Case dev1Value
              			Case 1 to 98
              				' Device DIM, set its current dim level
              				hs.CAPIControlHandler(hs.CAPIGetSingleControl(targetDev2, false, CStr(dev1Value), false, true))
              				If Debug Then hs.writelog(logName,CStr(targetDev2) & ":" & CStr(dev1Value))
              			Case 99
              				' Device ON, set it to on
              				hs.CAPIControlHandler(hs.CAPIGetSingleControl(targetDev2, false, "On", false, [U][B][COLOR="Red"]false[/COLOR][/B][/U]))
              				If Debug Then hs.writelog(logName,CStr(targetDev2) & " Set to On")
              			Case 0
              				' Device OFF, set it to off
              				hs.CAPIControlHandler(hs.CAPIGetSingleControl(targetDev2, false, "Off", false, true))
              				If Debug Then hs.writelog(logName,CStr(targetDev2) & " Set to Off")
              		End Select
              	Else
              			If Debug Then hs.writelog(logName,"Devices are at same value already")
              	End If
              
              End Sub
              HS 4.2.8.0: 2134 Devices 1252 Events
              Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

              Comment


                #22
                That did it! Works perfectly now.

                I cannot thank you enough. This isn't the first post where you've bailed me out.
                Much appreciated.

                On a side note - I have another setup with 1 master and 3 slave switches. I'll try to play with your script and add some additional devices and once I break it to the point of no return I'll post the issue

                Comment


                  #23
                  Great, glad it worked. Now that it's working, you can reduce the log entries when it runs by changing the line:

                  Code:
                  dim Debug as Boolean = True
                  to

                  Code:
                  dim Debug as Boolean = False
                  It should be relatively easy to adapt to a 3-way set up, but if you do run into trouble with it, I'll be glad to help.

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

                  Comment


                    #24
                    Al,

                    I have a few questions for you. I found this directly below in the help documentation for the CAPIGetSingleControl but I don't understand what the last parameter is. Can you explain that for me?

                    Public Function CAPIGetSingleControl(ByVal dvRef As Integer, _
                    ByVal SingleRangeEntry As Boolean, _
                    ByVal Label As String, _
                    ByVal ExactCase As Boolean, _
                    ByVal Contains As Boolean) As CAPIControl

                    I was able to get my Cooper Master and Accessory switches to finally sync up thanks to your script but I had to add events to both the master and accessory value changes. So now I see both events firing when either value is changed. I seem to recall a that there is a way to tell HS not to fire an event if the value was changed via another event but I can't find any documentation on that. Was I dreaming or is thee a way to do that?

                    Thanks

                    Comment


                      #25
                      Hi Andrew, see this post for an explanation of those parameters: http://board.homeseer.com/showpost.p...7&postcount=13. To prevent circular triggers, you can add the status of the device as a condition or in this case you may need to use a virtual device to do that.

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

                      Comment


                        #26
                        Thanks for the link Al. I may just leave the events as is since they check status and do nothing if the same anyway.

                        Comment


                          #27
                          This will work for keeping two dimmers in sync!

                          Create two separate events title first one: " insert name of room" Dim 1 and the other "insert name of room" dim 2 or whatever works for you. Baiscally just need two events.


                          Use this script below which I originally got from sparkman


                          Sub Main(ByVal Parms as String)

                          Dim ParmArray() as String
                          ParmArray = Parms.tostring.split(",")
                          dim targetDev1 as Double = CDbl(ParmArray(0)) 'reference ID of the device to use for existing value
                          dim targetDev2 as Double = CDbl(ParmArray(1)) 'reference ID of the device to set based on value of targetDev1
                          dim Debug as Boolean = False
                          Dim logName = "Dim Follower" 'set log name for HS log

                          Dim dev1Value,dev2Value As Double
                          dev1Value = hs.DeviceValue(targetDev1)
                          dev2Value = hs.DeviceValue(targetDev2)

                          If Debug Then hs.writelog(logName,CStr(targetDev1) & ":" & CStr(dev1Value))
                          If dev1Value <> dev2Value Then
                          Select Case dev1Value
                          Case Is > 0
                          ' Device ON or DIM, set its current dim level
                          hs.CAPIControlHandler(hs.CAPIGetSingleControl(targetDev2, false, CStr(dev1Value), false, true))
                          If Debug Then hs.writelog(logName,CStr(targetDev2) & ":" & CStr(dev1Value))
                          Case 0
                          ' Device OFF, set it to off
                          hs.CAPIControlHandler(hs.CAPIGetSingleControl(targetDev2, false, "Off", false, true))
                          If Debug Then hs.writelog(logName,CStr(targetDev2) & " Set to Off")
                          End Select
                          Else
                          If Debug Then hs.writelog(logName,"Devices are at same value already")
                          End If

                          End Sub



                          If you need further help creating the 2 events and using above script let me know and I can elaborate more.

                          So now the key to making it all work flawlessly is to now go to each dimmer device in homeseer and under status graphics for the master dimmer and accessory dimmer change the ON value from 99 to 98 for both.

                          Then it will work. Took me months to figure this out. Same logic can be applied to 3 dimmer switches( one master and 2 accessory) If you have that set up you create three dimmer events and change each On status to value of 98 as well under status graphics.

                          If need further help private message me.

                          Comment


                            #28
                            Originally posted by csullivan2005 View Post
                            If you need further help creating the 2 events and using above script let me know and I can elaborate more.

                            So now the key to making it all work flawlessly is to now go to each dimmer device in homeseer and under status graphics for the master dimmer and accessory dimmer change the ON value from 99 to 98 for both.

                            Then it will work. Took me months to figure this out. Same logic can be applied to 3 dimmer switches( one master and 2 accessory) If you have that set up you create three dimmer events and change each On status to value of 98 as well under status graphics.

                            If need further help private message me.
                            The version of the script in post 21 of this thread accounts for the on being 99 so no need to change values under the status graphics tab anymore.

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

                            Comment


                              #29
                              Thanks

                              Great! I didn't see that there was a second page in the thread when I posted. I will use the script in post 21 to simplify things. Thanks Sparkman!

                              Comment


                                #30
                                I'm racking my brain trying to figure out the best approach for these Cooper's. I have one light that has 1 master and 3 accessories. I've yet to implement any sync script because I was trying to figure out how to check the other 3 for their status and sync accordingly. If I make a change to any switch then all 4 will be updated but once they get updated won't they kick off the script to check the other 3 and on and on it would go?

                                I have the Al's script in place for 3 of my 2 switch 3-way circuits (works perfect) but have a 3 switch and 4 switch 3-way still out there I need to sync.

                                Does the csullivan2005 script do the trick? Is there an updated version from csulllivan2005 that reflects the post 21 update Al made to the base script?

                                Thanks

                                Comment

                                Working...
                                X