Announcement

Collapse
No announcement yet.

HS-WS100+ scene to control dimmer

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

  • HS-WS100+ scene to control dimmer

    I have two HS-WS100+ switches connected to 12V DC supplies powering LED PWM Z-wave Solid Apollo Z-Wave LED Dimmer Controller dimmers. Electrically this works very well, smooth dimming with no buzzing to a very low light level. How do I implement behavior like press-and-hold to increase or decrease dimming? Double tap to full-brightness? I would like the scene controller to operate this external dimmer. Apologies if this is a newb question, please direct me to the appropriate resource.
    Attached Files
    Z-Wave LED DimmerSolid Apollo’s Z-Wave LED Dimmer is designed to be integrated onto existing Z-Wave home automation systems.If you already own or have a Z-Wave system in your home, this controller will enable you to easily control LED Lights such as L

  • #2
    The double tap to full brightness is the easiest thing to implement. Use your central scene "had its value set to Scene 001 Key Pressed 2 Times" to set the dimmer to 'on'

    Dimming up/down when holding the dimmer up/down is harder to implement. I started working on this issue but then abandoned my work when I changed how my lights were configured. I had decided to use a script that was triggered by the central scene 'had its value set to Scene 001 (002) Key Held Down". The script would read the lights current value and increment/decrement it's value until the central scene was set to Scene 001 (002) Key released.

    Comment


    • #3
      Originally posted by jmaddox View Post
      The double tap to full brightness is the easiest thing to implement. Use your central scene "had its value set to Scene 001 Key Pressed 2 Times" to set the dimmer to 'on'

      Dimming up/down when holding the dimmer up/down is harder to implement. I started working on this issue but then abandoned my work when I changed how my lights were configured. I had decided to use a script that was triggered by the central scene 'had its value set to Scene 001 (002) Key Held Down". The script would read the lights current value and increment/decrement it's value until the central scene was set to Scene 001 (002) Key released.
      Thanks for the reply. You're right, it was easy to implement a specific dimming level using "had its value set to Scene 001 Key Pressed 2 Times", but I also need to implement dimming increase/decrease by holding down the up or down scene key. I would think this use case had been addressed before, but if you needed to write a script to do it, it sounds like maybe it hasn't? Is there a sub-forum better suited for addressing the script questions? How far did you get in your script efforts, are they worth sharing? It sounds like increment/decrement device isn't supported within the HS3 GUI, as well as "Scene 001 Key Held down" from the HS-WS100+ scene controller?

      Dimmer level interface, electrical and software below:





      Click image for larger version  Name:	Dimmer levels.png Views:	1 Size:	377.9 KB ID:	1263704
      Last edited by lifespeed; December 8th, 2018, 02:46 PM. Reason: added photo

      Comment


      • #4
        I have a similar situation. Trying to use the Scene 001 Key Held Down function on my HS-WS100+ to incrementally brighten my Lifx bulbs.

        Comment


        • #5
          With my system a dimrate of 100 works fairly well... the higher the number the finer your dimming control will be. Too low and you'll always either turn the load on or off before you have a chance to release the key.

          Code:
          Public Sub Main(ByVal Parms As Object)
                  '' This script should be called when a central scene is set to "held down"
                  '' it dims A dimmable device either up Or down until the central scene becomes "key released" or the load hits 99 or 0
                  '' Parameters '<device ref #>|<device ref central scene #>|up|<dimrate>' or '<device ref #>|<device ref central scene #>|down|<dimrate>'
                  '' ie: 79|78|up|10
          
                  Dim ParmArray() As String
                  ParmArray = Parms.ToString.Split(ToChar("|"))
          
                  Dim DeviceRef As Integer = Integer.Parse(ParmArray(0))
                  Dim DeviceValue As Integer = hs.DeviceValue(DeviceRef)
                  Dim DeviceRefCS As Integer = Integer.Parse(ParmArray(1))
                  Dim DeviceValueCS As Integer
                  Dim Keyreleased As Integer = 1001
          
                  Dim UpDown As String = ParmArray(2)
          
                  '' DimStep is the increment value for each dim setting
                  Dim DimStep As Integer = 3
          
                  If UpDown = "down" Then DimStep = DimStep * -1
                  If UpDown = "down" Then Keyreleased = 2001
          
                  '' DimRate is how long to take between dim levels; ie the rate of dimming in milliseconds
                  Dim DimRate As Integer = Integer.Parse(ParmArray(3))
          
          
                  For value As Integer = 0 To 100
          
                      '' increment the dim% value then set min and max values
                      DeviceValue = DeviceValue + DimStep
                      If DeviceValue > 99 Then DeviceValue = 99
                      If DeviceValue < 0 Then DeviceValue = 0
          
                      '' set the device to the current value
                      Dim cc As HomeSeerAPI.CAPIControl = hs.CAPIGetSingleControl(DeviceRef, True, "Dim (value)%", False, False)
                      cc.ControlValue = DeviceValue
                      Dim cr As HomeSeerAPI.CAPIControlResponse = hs.CAPIControlHandler(cc)
          
                      '' get current central scene value
                      DeviceValueCS = hs.DeviceValue(DeviceRefCS)
          
                      '' check to see if we should exit the loop
                      If DeviceValue = 0 Or DeviceValue = 99 Or DeviceValueCS = Keyreleased Then Exit Sub
          
                      Thread.Sleep(DimRate)
                  Next
          
              End Sub

          Comment


          • #6
            Originally posted by jmaddox View Post
            With my system a dimrate of 100 works fairly well... the higher the number the finer your dimming control will be. Too low and you'll always either turn the load on or off before you have a chance to release the key.
            Sorry for the slow reply, thanks for posting your code. Should the file extension be .VBS? Did your code work, you mentioned ditching it for a different solution? Are you able to provide some guidance on how this integrates in HS3? I copied the script into the scripts folder, but don't know where to find it in HS3 interface. Looking at the HS3 documentation now, we'll see how far that gets me.

            Comment


            • #7
              Originally posted by lifespeed View Post

              Sorry for the slow reply, thanks for posting your code. Should the file extension be .VBS? Did your code work, you mentioned ditching it for a different solution? Are you able to provide some guidance on how this integrates in HS3? I copied the script into the scripts folder, but don't know where to find it in HS3 interface. Looking at the HS3 documentation now, we'll see how far that gets me.
              That is a working script, the one I had was lacking the coding to exit when the key changed to released; I added that in before posting. The script should have a .vb extension. You will need to know the device id of the central scene on the switch you are going to use to control your dimmer. you'll also need to know the device id of the zwave dimmer controlling your LED's.

              you'll need to create two events. one to dim the light up, and one to dim it down. When you create your event you'll click the 'edit' button to browse to your script. You can also create a new script using the same dialog. When the Select a script file dialog pops up, either select a script you already have in that folder or append a new script name at the end of c:/program files/homeseer hs3/scripts/newscript.vb. You'll be given a blank script in the edit box dialog you can then paste into or alter as you wish. be careful in that if you use the same script name in multiple events, editing it in one, edits the script file which then affects all your events.

              Here is a screen capture of the event I used to test dimming a light down. You'll need to change your parameters to reflect your device id's

              Click image for larger version

Name:	dim light down.JPG
Views:	1
Size:	151.4 KB
ID:	1265303

              when you click 'edit' this dialog will pop up, pick the script you saved, or create a new one by adding the name at the end of / and hitting submit.

              Click image for larger version

Name:	select a script.JPG
Views:	1
Size:	47.1 KB
ID:	1265304

              Comment


              • #8
                Hi Jmaddox

                I just found your script and is trying to get it to work. I´m using it the same way you do, but are getting an error in the log. The error is:

                Running script C:\Program Files (x86)\HomeSeer HS3\scripts\Dim_Load.vb :Exception has been thrown by the target of an invocation.Object reference not set to an instance of an object.

                you say I need to use the "Device Ref ID". Is that the value I can find under the device -> Advanced? Or is it located under the Device -> Z-wave -> Node ID

                I´m trying to get it to work, but with no luck. Do you have any idea what that error means?

                Happy New Year.

                Best regards
                Thomas

                Comment


                • #9
                  I am sorry I do not know why you're getting that error, other than I don't tend to include error catching in my scripts I'm really more of a monkey with a keyboard than an actual programmer... I suspect you're not providing all the parameters the script expects. You can find a device's ref ID under the Advanced tab. it's the top item 'Reference ID'

                  Comment

                  Working...
                  X